PLCnext API Documentation 25.0.2.69
fmt_cast.hxx
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
7#include <utility>
8#include <memory>
9
10namespace Arp { namespace Base { namespace Core
11{
12
17template<typename T>
18inline decltype(auto) fmt_cast(T&& value)
19{
20 return std::forward<T>(value);
21}
22
27template<typename T>
28inline auto fmt_cast(const std::shared_ptr<T>& value)
29{
30 return static_cast<void*>(value.get());
31}
32
34template<typename T>
35inline auto fmt_cast(const std::shared_ptr<const T>& value)
36{
37 return static_cast<const void*>(value.get());
38}
39
41inline auto fmt_cast(int8 value)
42{
43 return static_cast<int>(value);
44}
45
47inline auto fmt_cast(uint8 value)
48{
49 return static_cast<unsigned int>(value);
50}
51
56inline auto fmt_cast(byte value)
57{
58 return Byte(value);
59}
60
61}}} // end of namespace Arp::Base::Core
62
63namespace Arp {
65using Arp::Base::Core::fmt_cast;
66}
std::uint8_t uint8
The Arp unsigned integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:25
std::int8_t int8
The Arp integer type of 1 byte size.
Definition: PrimitiveTypes.hpp:27
Root namespace for the PLCnext API