...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The header <boost/core/size.hpp> provides function templates size
to obtain the number of elements in
a range.
namespace boost { template<class C> constexpr auto size(const C& c) noexcept(noexcept(c.size())) -> decltype(c.size()); template<class T, std::size_t N> constexpr std::size_t size(T(&)[N]) noexcept; } /* boost */
template<class C> constexpr
auto size(const C& c) noexcept(noexcept(c.size()))
-> decltype(c.size());
Returns c.size()
.
template<class T, std::size_t
N>
constexpr std::size_t
size(T(&)[N]) noexcept;
Returns N
.