The BOOST_PP_TUPLE_ELEM macro extracts an element from a tuple.

Usage

BOOST_PP_TUPLE_ELEM(size, i, tuple)

or

BOOST_PP_TUPLE_ELEM(...) (v)

Arguments

size
The size of the tuple.  Valid tuple sizes range from 1 to BOOST_PP_LIMIT_TUPLE
i
The zero-based index into the tuple of the element to be extracted.  Valid values range from 0 to size - 1.
tuple
The tuple from which an element is to be extracted.

Remarks

The size argument must be the actual size of the tuple, and i must be less than the size of the tuple.

You can invoke the variadic version as BOOST_PP_TUPLE_ELEM(i,tuple) or BOOST_PP_TUPLE_ELEM(size,i,tuple).

See Also

Requirements

Header:  <boost/preprocessor/tuple/elem.hpp>

Sample Code

#include <boost/preprocessor/tuple/elem.hpp>

#define TUPLE (a, b, c, d)

BOOST_PP_TUPLE_ELEM(4, 0, TUPLE) // expands to a
BOOST_PP_TUPLE_ELEM(4, 3, TUPLE) // expands to d

// or for the variadic version (v)

BOOST_PP_TUPLE_ELEM(0, TUPLE) // expands to a in the variadic version
BOOST_PP_TUPLE_ELEM(3, TUPLE) // expands to d in the variadic version

© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002
© Copyright Edward Diener 2011,2013

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)