...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/data.hpp> provides function templates data
to obtain the pointer to the first
element in a range.
namespace boost { template<class C> constexpr auto data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data()); template<class C> constexpr auto data(const C& c) noexcept(noexcept(c.data())) -> decltype(c.data()); template<class T, std::size_t N> constexpr T* data(T(&a)[N]) noexcept; template<class T> constexpr const T* data(std::initializer_list<T> l) noexcept; } /* boost */
template<class C> constexpr
auto data(C& c) noexcept(noexcept(c.data())) -> decltype(c.data());
Returns c.data()
.
template<class C> constexpr
auto data(const C& c) noexcept(noexcept(c.data()))
-> decltype(c.data());
Returns c.data()
.
template<class T, std::size_t
N>
constexpr T* data(T(&a)[N]) noexcept;
Returns a
.
template<class T> constexpr
const T* data(std::initializer_list<T> l) noexcept;
Returns l.begin()
.