tagged_scalar.hpp
Go to the documentation of this file.
/*
* RESTinio
*/
#pragma once
#include <restinio/compiler_features.hpp>
#include <type_traits>
namespace restinio
{
namespace utils
{
//
// tagged_scalar_t
//
template< typename Scalar, typename Tag >
class tagged_scalar_t
{
static_assert( std::is_scalar<Scalar>::value,
"Scalar is expected to be scalar type" );
Scalar m_value;
public:
constexpr explicit tagged_scalar_t( Scalar value ) noexcept
: m_value{ value }
{}
RESTINIO_NODISCARD
constexpr Scalar
value() const noexcept { return m_value; }
};
} /* namespace utils */
} /* namespace restinio */
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