]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*! |
2 | @file | |
3 | Forward declares `boost::hana::basic_tuple`. | |
4 | ||
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) | |
8 | */ | |
9 | ||
10 | #ifndef BOOST_HANA_FWD_BASIC_TUPLE_HPP | |
11 | #define BOOST_HANA_FWD_BASIC_TUPLE_HPP | |
12 | ||
13 | #include <boost/hana/config.hpp> | |
14 | #include <boost/hana/fwd/core/make.hpp> | |
15 | ||
16 | ||
17 | BOOST_HANA_NAMESPACE_BEGIN | |
18 | //! @ingroup group-datatypes | |
19 | //! Stripped down version of `hana::tuple`. | |
20 | //! | |
21 | //! Whereas `hana::tuple` aims to provide an interface somewhat close to a | |
22 | //! `std::tuple`, `basic_tuple` provides the strict minimum required to | |
23 | //! implement a closure with maximum compile-time efficiency. | |
24 | //! | |
25 | //! | |
26 | //! Modeled concepts | |
27 | //! ---------------- | |
28 | //! `Sequence`, and all the concepts it refines | |
29 | template <typename ...Xs> | |
30 | struct basic_tuple; | |
31 | ||
32 | //! Tag representing `hana::basic_tuple`. | |
33 | //! @relates hana::basic_tuple | |
34 | struct basic_tuple_tag { }; | |
35 | ||
36 | #ifdef BOOST_HANA_DOXYGEN_INVOKED | |
37 | //! Function object for creating a `basic_tuple`. | |
38 | //! @relates hana::basic_tuple | |
39 | //! | |
40 | //! Given zero or more objects `xs...`, `make<basic_tuple_tag>` returns a | |
41 | //! new `basic_tuple` containing those objects. The elements are held by | |
42 | //! value inside the resulting tuple, and they are hence copied or moved | |
43 | //! in. This is analogous to `std::make_tuple` for creating `basic_tuple`s. | |
44 | //! | |
45 | //! | |
46 | //! Example | |
47 | //! ------- | |
48 | //! @include example/basic_tuple/make.cpp | |
49 | template <> | |
50 | constexpr auto make<basic_tuple_tag> = [](auto&& ...xs) { | |
51 | return basic_tuple<std::decay_t<decltype(xs)>...>{forwarded(xs)...}; | |
52 | }; | |
53 | #endif | |
54 | ||
55 | //! Alias to `make<basic_tuple_tag>`; provided for convenience. | |
56 | //! @relates hana::basic_tuple | |
57 | //! | |
58 | //! | |
59 | //! Example | |
60 | //! ------- | |
61 | //! @include example/basic_tuple/make.cpp | |
62 | constexpr auto make_basic_tuple = make<basic_tuple_tag>; | |
63 | BOOST_HANA_NAMESPACE_END | |
64 | ||
65 | #endif // !BOOST_HANA_FWD_BASIC_TUPLE_HPP |