diff options
Diffstat (limited to 'boost/hana/fwd/basic_tuple.hpp')
-rw-r--r-- | boost/hana/fwd/basic_tuple.hpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/boost/hana/fwd/basic_tuple.hpp b/boost/hana/fwd/basic_tuple.hpp new file mode 100644 index 0000000000..e2e78fbbcf --- /dev/null +++ b/boost/hana/fwd/basic_tuple.hpp @@ -0,0 +1,65 @@ +/*! +@file +Forward declares `boost::hana::basic_tuple`. + +@copyright Louis Dionne 2013-2016 +Distributed under the Boost Software License, Version 1.0. +(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_HANA_FWD_BASIC_TUPLE_HPP +#define BOOST_HANA_FWD_BASIC_TUPLE_HPP + +#include <boost/hana/config.hpp> +#include <boost/hana/fwd/core/make.hpp> + + +BOOST_HANA_NAMESPACE_BEGIN + //! @ingroup group-datatypes + //! Stripped down version of `hana::tuple`. + //! + //! Whereas `hana::tuple` aims to provide an interface somewhat close to a + //! `std::tuple`, `basic_tuple` provides the strict minimum required to + //! implement a closure with maximum compile-time efficiency. + //! + //! + //! Modeled concepts + //! ---------------- + //! `Sequence`, and all the concepts it refines + template <typename ...Xs> + struct basic_tuple; + + //! Tag representing `hana::basic_tuple`. + //! @relates hana::basic_tuple + struct basic_tuple_tag { }; + +#ifdef BOOST_HANA_DOXYGEN_INVOKED + //! Function object for creating a `basic_tuple`. + //! @relates hana::basic_tuple + //! + //! Given zero or more objects `xs...`, `make<basic_tuple_tag>` returns a + //! new `basic_tuple` containing those objects. The elements are held by + //! value inside the resulting tuple, and they are hence copied or moved + //! in. This is analogous to `std::make_tuple` for creating `basic_tuple`s. + //! + //! + //! Example + //! ------- + //! @include example/basic_tuple/make.cpp + template <> + constexpr auto make<basic_tuple_tag> = [](auto&& ...xs) { + return basic_tuple<std::decay_t<decltype(xs)>...>{forwarded(xs)...}; + }; +#endif + + //! Alias to `make<basic_tuple_tag>`; provided for convenience. + //! @relates hana::basic_tuple + //! + //! + //! Example + //! ------- + //! @include example/basic_tuple/make.cpp + constexpr auto make_basic_tuple = make<basic_tuple_tag>; +BOOST_HANA_NAMESPACE_END + +#endif // !BOOST_HANA_FWD_BASIC_TUPLE_HPP |