COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
cast.h
Go to the documentation of this file.
1//
2// Copyright 2019 - 2025 (C). Alex Robenko. All rights reserved.
3//
4// This Source Code Form is subject to the terms of the Mozilla Public
5// License, v. 2.0. If a copy of the MPL was not distributed with this
6// file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
10
11#pragma once
12
13#include "comms/details/FieldCastHelper.h"
14#include "comms/details/ValueAssignWrapper.h"
15
16namespace comms
17{
18
27template <typename T>
28details::ValueAssignWrapper<T> cast_assign(T& value)
29{
30 return details::ValueAssignWrapper<T>(value);
31}
32
51template <typename TFieldTo, typename TFieldFrom>
52TFieldTo field_cast(const TFieldFrom& field)
53{
54 return details::FieldCastHelper<>::template cast<TFieldTo, TFieldFrom>(field);
55}
56
57} // namespace comms
Main namespace for all classes / functions of COMMS library.
TFieldTo field_cast(const TFieldFrom &field)
Cast between fields.
Definition cast.h:52
details::ValueAssignWrapper< T > cast_assign(T &value)
Helper function to assign value with static_cast to appropriate type.
Definition cast.h:28