RESTinio

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