• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*!
2 @file
3 Forward declares `boost::hana::basic_tuple`.
4 
5 @copyright Louis Dionne 2013-2017
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     //! @note
26     //! When you use a container, remember not to make assumptions about its
27     //! representation, unless the documentation gives you those guarantees.
28     //! More details [in the tutorial](@ref tutorial-containers-types).
29     //!
30     //!
31     //! Modeled concepts
32     //! ----------------
33     //! `Sequence`, and all the concepts it refines
34     template <typename ...Xs>
35     struct basic_tuple;
36 
37     //! Tag representing `hana::basic_tuple`.
38     //! @relates hana::basic_tuple
39     struct basic_tuple_tag { };
40 
41 #ifdef BOOST_HANA_DOXYGEN_INVOKED
42     //! Function object for creating a `basic_tuple`.
43     //! @relates hana::basic_tuple
44     //!
45     //! Given zero or more objects `xs...`, `make<basic_tuple_tag>` returns a
46     //! new `basic_tuple` containing those objects. The elements are held by
47     //! value inside the resulting tuple, and they are hence copied or moved
48     //! in. This is analogous to `std::make_tuple` for creating `basic_tuple`s.
49     //!
50     //!
51     //! Example
52     //! -------
53     //! @include example/basic_tuple/make.cpp
54     template <>
__anon55475f2b0102(auto&& ...xs) 55     constexpr auto make<basic_tuple_tag> = [](auto&& ...xs) {
56         return basic_tuple<std::decay_t<decltype(xs)>...>{forwarded(xs)...};
57     };
58 #endif
59 
60     //! Alias to `make<basic_tuple_tag>`; provided for convenience.
61     //! @relates hana::basic_tuple
62     //!
63     //!
64     //! Example
65     //! -------
66     //! @include example/basic_tuple/make.cpp
67     constexpr auto make_basic_tuple = make<basic_tuple_tag>;
68 BOOST_HANA_NAMESPACE_END
69 
70 #endif // !BOOST_HANA_FWD_BASIC_TUPLE_HPP
71