3 Forward declares `boost::hana::length`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_LENGTH_HPP
11 #define BOOST_HANA_FWD_LENGTH_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Return the number of elements in a foldable structure.
19 //! @ingroup group-Foldable
21 //! Given a `Foldable` `xs`, `length(xs)` must return an object of an
22 //! unsigned integral type, or an `IntegralConstant` holding such an
23 //! object, which represents the number of elements in the structure.
26 //! Since only compile-time `Foldable`s are supported in the library
27 //! right now, `length` must always return an `IntegralConstant`.
32 //! @include example/length.cpp
33 #ifdef BOOST_HANA_DOXYGEN_INVOKED
34 constexpr auto length = [](auto const& xs) {
35 return tag-dispatched;
38 template <typename T, typename = void>
39 struct length_impl : length_impl<T, when<true>> { };
42 template <typename Xs>
43 constexpr auto operator()(Xs const& xs) const;
46 constexpr length_t length{};
48 BOOST_HANA_NAMESPACE_END
50 #endif // !BOOST_HANA_FWD_LENGTH_HPP