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 - 2026 (C). Alex Robenko. All rights reserved.
3//
4// SPDX-License-Identifier: MPL-2.0
5//
6// This Source Code Form is subject to the terms of the Mozilla Public
7// License, v. 2.0. If a copy of the MPL was not distributed with this
8// file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
12
13#pragma once
14
15#include "comms/details/FieldCastHelper.h"
16#include "comms/details/ValueAssignWrapper.h"
17
18namespace comms
19{
20
29template <typename T>
30details::ValueAssignWrapper<T> cast_assign(T& value)
31{
32 return details::ValueAssignWrapper<T>(value);
33}
34
53template <typename TFieldTo, typename TFieldFrom>
54TFieldTo field_cast(const TFieldFrom& field)
55{
56 return details::FieldCastHelper<>::template cast<TFieldTo, TFieldFrom>(field);
57}
58
59} // namespace comms
Main namespace for all classes / functions of COMMS library.
TFieldTo field_cast(const TFieldFrom &field)
Cast between fields.
Definition cast.h:54
details::ValueAssignWrapper< T > cast_assign(T &value)
Helper function to assign value with static_cast to appropriate type.
Definition cast.h:30