1/*=============================================================================
2 Copyright (c) 2014-2015 Kohei Takahashi
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6==============================================================================*/
7#ifndef FUSION_TUPLE_14122014_0102
8#define FUSION_TUPLE_14122014_0102
9
10#include <boost/fusion/support/config.hpp>
11#include <boost/fusion/tuple/tuple_fwd.hpp>
12
13///////////////////////////////////////////////////////////////////////////////
14// With no variadics, we will use the C++03 version
15///////////////////////////////////////////////////////////////////////////////
16#if !defined(BOOST_FUSION_HAS_VARIADIC_TUPLE)
17# include <boost/fusion/tuple/detail/tuple.hpp>
18#else
19
20///////////////////////////////////////////////////////////////////////////////
21// C++11 interface
22///////////////////////////////////////////////////////////////////////////////
23#include <boost/fusion/container/vector/vector.hpp>
24#include <boost/fusion/sequence/intrinsic/size.hpp>
25#include <boost/fusion/sequence/intrinsic/value_at.hpp>
26#include <boost/fusion/sequence/intrinsic/at.hpp>
27#include <boost/fusion/sequence/comparison.hpp>
28#include <boost/fusion/sequence/io.hpp>
29#include <utility>
30
31namespace boost { namespace fusion
32{
33 template <typename ...T>
34 struct tuple : vector<T...>
35 {
36 typedef vector<T...> base_type;
37
38 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
39 tuple()
40 : base_type() {}
41
42 template <typename ...U>
43 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
44 tuple(tuple<U...> const& other)
45 : base_type(other) {}
46
47 template <typename ...U>
48 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
49 tuple(tuple<U...>&& other)
50 : base_type(std::move(other)) {}
51
52 template <typename ...U>
53 /*BOOST_CONSTEXPR*/ BOOST_FUSION_GPU_ENABLED
54 explicit
55 tuple(U&&... args)
56 : base_type(std::forward<U>(args)...) {}
57
58 template <typename U>
59 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
60 tuple& operator=(U&& rhs)
61 {
62 base_type::operator=(std::forward<U>(rhs));
63 return *this;
64 }
65 };
66
67 template <typename Tuple>
68 struct tuple_size : result_of::size<Tuple> {};
69
70 template <int N, typename Tuple>
71 struct tuple_element : result_of::value_at_c<Tuple, N> {};
72
73 template <int N, typename Tuple>
74 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
75 inline typename result_of::at_c<Tuple, N>::type
76 get(Tuple& tup)
77 {
78 return at_c<N>(tup);
79 }
80
81 template <int N, typename Tuple>
82 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
83 inline typename result_of::at_c<Tuple const, N>::type
84 get(Tuple const& tup)
85 {
86 return at_c<N>(tup);
87 }
88}}
89
90#endif
91#endif
92
93

source code of boost/boost/fusion/tuple/tuple.hpp