Boost.Hana  1.7.1
Your standard library for metaprogramming
boost::hana::basic_tuple< Xs > Struct Template Reference

Description

template<typename ... Xs>
struct boost::hana::basic_tuple< Xs >

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.

Note
When you use a container, remember not to make assumptions about its representation, unless the documentation gives you those guarantees. More details in the tutorial.

Modeled concepts

Sequence, and all the concepts it refines

Synopsis of associated functions

template<>
constexpr auto make< basic_tuple_tag >
 Function object for creating a basic_tuple. More...
 
constexpr auto make_basic_tuple = make<basic_tuple_tag>
 Alias to make<basic_tuple_tag>; provided for convenience. More...
 

Associated functions

◆ make< basic_tuple_tag >

template<typename ... Xs>
template<>
constexpr auto make< basic_tuple_tag >
related
Initial value:
= [](auto&& ...xs) {
return basic_tuple<std::decay_t<decltype(xs)>...>{forwarded(xs)...};
}

Function object for creating a 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_tuples.

Example

// Copyright Louis Dionne 2013-2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <type_traits>
namespace hana = boost::hana;
constexpr hana::basic_tuple<int, char, double> xs{1, '2', 3.3};
constexpr auto ys = hana::make<hana::basic_tuple_tag>(1, '2', 3.3);
constexpr auto zs = hana::make_basic_tuple(1, '2', 3.3);
static_assert(std::is_same<decltype(ys), decltype(xs)>::value, "");
static_assert(std::is_same<decltype(zs), decltype(xs)>::value, "");
int main() { }
Defines boost::hana::basic_tuple.
Defines boost::hana::make.
constexpr auto value
Return the compile-time value associated to a constant.
Definition: value.hpp:54
Namespace containing everything in the library.
Definition: accessors.hpp:20

◆ make_basic_tuple

template<typename ... Xs>
constexpr auto make_basic_tuple = make<basic_tuple_tag>
related

Alias to make<basic_tuple_tag>; provided for convenience.

Example

// Copyright Louis Dionne 2013-2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <type_traits>
namespace hana = boost::hana;
constexpr hana::basic_tuple<int, char, double> xs{1, '2', 3.3};
constexpr auto ys = hana::make<hana::basic_tuple_tag>(1, '2', 3.3);
constexpr auto zs = hana::make_basic_tuple(1, '2', 3.3);
static_assert(std::is_same<decltype(ys), decltype(xs)>::value, "");
static_assert(std::is_same<decltype(zs), decltype(xs)>::value, "");
int main() { }