The BOOST_PP_LIST_TO_TUPLE_R macro converts a list to a tuple.  It reenters BOOST_PP_FOR with maximum efficiency.

Usage

BOOST_PP_LIST_TO_TUPLE_R(r, list)

Arguments

r
The next available BOOST_PP_FOR repetition.
list
The list to be converted.

Remarks

   If list is, for example, (a, (b, (c, BOOST_PP_NIL))), this macro will produce:

(a, b, c)  

   If the list to be converted is empty, as represented by 'BOOST_PP_NIL', the resulting tuple is undefined since a tuple cannot be empty.

See Also

Requirements

Header:  <boost/preprocessor/list/to_tuple.hpp>

Sample Code

#include <boost/preprocessor/list/adt.hpp>
#include <boost/preprocessor/list/to_tuple.hpp>
#include <boost/preprocessor/repetition/for.hpp>

#define LIST (x, (y, (z, BOOST_PP_NIL)))

#define PRED(r, state) BOOST_PP_LIST_IS_CONS(state)
#define OP(r, state) BOOST_PP_LIST_REST(state)
#define MACRO(r, state) BOOST_PP_LIST_TO_TUPLE_R(r, state)

BOOST_PP_FOR(LIST, PRED, OP, MACRO)
   // expands to (x, y, z) (y, z) (z)

© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002

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)