Minor refactoring to use <type_traits> and use available value in static_assert.

This commit is contained in:
Kern Handa 2015-09-24 23:41:44 -07:00
parent 8ae77b1fd5
commit 33e61f0115

View File

@ -81,9 +81,9 @@ namespace details
template <typename OtherConcreteType, typename OtherValueType, unsigned int OtherRank>
friend class coordinate_facade;
public:
using reference = ValueType&;
using const_reference = const ValueType&;
using value_type = ValueType;
using reference = typename std::add_lvalue_reference<ValueType>::type;
using const_reference = typename std::add_lvalue_reference<typename std::add_const<ValueType>::type>::type;
using value_type = typename std::remove_reference<typename std::remove_cv<ValueType>::type>::type;
static const unsigned int rank = Rank;
_CONSTEXPR coordinate_facade() _NOEXCEPT
{
@ -500,8 +500,8 @@ namespace details
template <typename SizeType, SizeType Fact1, SizeType Fact2, SizeType ConstBound>
struct StaticSizeHelperImpl
{
static_assert(static_cast<size_t>(Fact1) * static_cast<size_t>(Fact2) <= SizeTypeTraits<SizeType>::max_value, "Value out of the range of SizeType");
static const SizeType value = Fact1 * Fact2;
static_assert(static_cast<size_t>(value) <= SizeTypeTraits<SizeType>::max_value, "Value out of the range of SizeType");
};
template <typename SizeType, SizeType Fact1, SizeType ConstBound>