diff --git a/include/boost/hana.hpp b/include/boost/hana.hpp index 4135fe0bd..37631e05c 100644 --- a/include/boost/hana.hpp +++ b/include/boost/hana.hpp @@ -45,5 +45,6 @@ #include #include #include +#include #endif // !BOOST_HANA_HPP diff --git a/include/boost/hana/typelist.hpp b/include/boost/hana/typelist.hpp new file mode 100644 index 000000000..6b82c3c20 --- /dev/null +++ b/include/boost/hana/typelist.hpp @@ -0,0 +1,92 @@ +/*! + * @file + * Defines `boost::hana::Typelist`. + * + * + * @copyright Louis Dionne 2014 + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE.md or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_HANA_TYPELIST_HPP +#define BOOST_HANA_TYPELIST_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace boost { namespace hana { + //! @ingroup datatypes + template + struct Typelist { }; + + template + constexpr auto typelist = Typelist{}; + + template + struct Iterable> { + static constexpr auto head_impl(Typelist) + { return type; } + + static constexpr auto tail_impl(Typelist) + { return typelist; } + + static constexpr auto is_empty_impl(Typelist) + { return false_; } + }; + + template <> + struct Iterable> { + static constexpr auto is_empty_impl(Typelist<>) + { return true_; } + }; + + template + struct Functor> : defaults { + template + static constexpr auto fmap_impl(F f, Typelist) + { return list(f(type)...); } + + template