1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00
Sprout/sprout/detail/static_size.hpp
2017-07-29 14:20:01 +09:00

35 lines
1.1 KiB
C++

/*=============================================================================
Copyright (c) 2011-2017 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_DETAIL_STATIC_SIZE_HPP
#define SPROUT_DETAIL_STATIC_SIZE_HPP
#include <sprout/config.hpp>
namespace sprout {
namespace detail {
template<typename T, T V>
struct base_static_size {
public:
SPROUT_STATIC_CONSTEXPR T static_size = V;
public:
static SPROUT_CONSTEXPR T
fixed_size() SPROUT_NOEXCEPT {
return static_size;
}
};
template<typename T, T V>
SPROUT_CONSTEXPR_OR_CONST T sprout::detail::base_static_size<T, V>::static_size;
template<typename Container>
struct inherit_static_size
: public sprout::detail::base_static_size<typename Container::size_type, Container::static_size>
{};
} // namespace detail
} // namespace sprout
#endif // #ifndef SPROUT_DETAIL_STATIC_SIZE_HPP