Use integral_constant for serial constants
This commit is contained in:
parent
39b705b352
commit
a8bb0ad07d
|
@ -41,7 +41,7 @@ class integral_type
|
||||||
{
|
{
|
||||||
static_assert(tt::is_integral<T>::value, "integral_type used on non-integral type");
|
static_assert(tt::is_integral<T>::value, "integral_type used on non-integral type");
|
||||||
public:
|
public:
|
||||||
static const std::size_t maximum_size = sizeof(T);
|
static constexpr auto maximum_size = tt::integral_constant<std::size_t, sizeof(T)>{};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -49,7 +49,7 @@ class enum_type
|
||||||
{
|
{
|
||||||
static_assert(tt::is_enum<T>::value, "enum_type used on non-enum type");
|
static_assert(tt::is_enum<T>::value, "enum_type used on non-enum type");
|
||||||
public:
|
public:
|
||||||
static const std::size_t maximum_size = sizeof(T);
|
static constexpr auto maximum_size = tt::integral_constant<std::size_t, sizeof(T)>{};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename>
|
template <typename>
|
||||||
|
@ -93,8 +93,9 @@ class class_type;
|
||||||
template <typename>
|
template <typename>
|
||||||
class array_type;
|
class array_type;
|
||||||
|
|
||||||
struct endian_access
|
class endian_access
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
/*
|
/*
|
||||||
* Endian access modes:
|
* Endian access modes:
|
||||||
* - foreign_endian: assume buffered data is foreign endian
|
* - foreign_endian: assume buffered data is foreign endian
|
||||||
|
@ -185,8 +186,9 @@ message<array<uint8_t, amount>> udt_to_message(const pad_type<amount, value> &);
|
||||||
* specialization is missing.
|
* specialization is missing.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct missing_udt_specialization
|
class missing_udt_specialization
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
missing_udt_specialization() = delete;
|
missing_udt_specialization() = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -442,7 +444,7 @@ class message_type : message_dispatch_type<typename tt::remove_reference<T>::typ
|
||||||
typedef message_dispatch_type<typename tt::remove_reference<T>::type> base_type;
|
typedef message_dispatch_type<typename tt::remove_reference<T>::type> base_type;
|
||||||
typedef typename base_type::effective_type effective_type;
|
typedef typename base_type::effective_type effective_type;
|
||||||
public:
|
public:
|
||||||
static const std::size_t maximum_size = effective_type::maximum_size;
|
static constexpr auto maximum_size = effective_type::maximum_size;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename A1>
|
template <typename A1>
|
||||||
|
@ -463,7 +465,7 @@ template <typename T, std::size_t N>
|
||||||
class array_type<const array<T, N>>
|
class array_type<const array<T, N>>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const std::size_t maximum_size = message_type<T>::maximum_size * N;
|
static constexpr auto maximum_size = tt::integral_constant<std::size_t, message_type<T>::maximum_size * N>{};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T, std::size_t N>
|
template <typename T, std::size_t N>
|
||||||
|
@ -476,7 +478,7 @@ class message_type<message<A1, A2, Args...>>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef message<A1, A2, Args...> as_message;
|
typedef message<A1, A2, Args...> as_message;
|
||||||
static const std::size_t maximum_size = message_type<A1>::maximum_size + message_type<message<A2, Args...>>::maximum_size;
|
static constexpr auto maximum_size = tt::integral_constant<std::size_t, message_type<A1>::maximum_size + message_type<message<A2, Args...>>::maximum_size>{};
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename A1, typename... Args>
|
template <typename A1, typename... Args>
|
||||||
|
|
Loading…
Reference in a new issue