RESTinio
tagged_scalar.hpp
Go to the documentation of this file.
1/*
2 * RESTinio
3 */
4
12#pragma once
13
15
16#include <type_traits>
17
18namespace restinio
19{
20
21namespace utils
22{
23
24//
25// tagged_scalar_t
26//
52template< typename Scalar, typename Tag >
54{
55 static_assert( std::is_scalar<Scalar>::value,
56 "Scalar is expected to be scalar type" );
57
58 Scalar m_value;
59
60public:
61 constexpr explicit tagged_scalar_t( Scalar value ) noexcept
62 : m_value{ value }
63 {}
64
66 constexpr Scalar
67 value() const noexcept { return m_value; }
68};
69
70} /* namespace utils */
71
72} /* namespace restinio */
73
Helper template for defining tagged scalar types.
RESTINIO_NODISCARD constexpr Scalar value() const noexcept
constexpr tagged_scalar_t(Scalar value) noexcept
Detection of compiler version and absence of various features.
#define RESTINIO_NODISCARD
#define const
Definition: zconf.h:230