]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/preprocessor/tuple/elem.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / preprocessor / tuple / elem.hpp
CommitLineData
7c673cae
FG
1# /* Copyright (C) 2001
2# * Housemarque Oy
3# * http://www.housemarque.com
4# *
5# * Distributed under the Boost Software License, Version 1.0. (See
6# * accompanying file LICENSE_1_0.txt or copy at
7# * http://www.boost.org/LICENSE_1_0.txt)
8# */
9#
10# /* Revised by Paul Mensonides (2002-2011) */
20effc67 11# /* Revised by Edward Diener (2011,2014,2020) */
7c673cae
FG
12#
13# /* See http://www.boost.org for most recent version. */
14#
15# ifndef BOOST_PREPROCESSOR_TUPLE_ELEM_HPP
16# define BOOST_PREPROCESSOR_TUPLE_ELEM_HPP
17#
18# include <boost/preprocessor/cat.hpp>
19# include <boost/preprocessor/config/config.hpp>
20# include <boost/preprocessor/facilities/expand.hpp>
21# include <boost/preprocessor/facilities/overload.hpp>
22# include <boost/preprocessor/tuple/rem.hpp>
23# include <boost/preprocessor/variadic/elem.hpp>
24# include <boost/preprocessor/tuple/detail/is_single_return.hpp>
25#
20effc67
TL
26# if BOOST_PP_VARIADICS_MSVC
27# define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__), (__VA_ARGS__))
28# define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args)
29# define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,)
7c673cae
FG
30/*
31 Use BOOST_PP_REM_CAT if it is a single element tuple ( which might be empty )
32 else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM
33 functionality. See tuple_elem_bug_test.cxx.
34*/
20effc67
TL
35# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \
36 BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_EXPAND(BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple)) \
37 /**/
7c673cae 38# else
20effc67
TL
39# define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__)
40# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple)
7c673cae 41# endif
20effc67 42# define BOOST_PP_TUPLE_ELEM_O_3(size, n, tuple) BOOST_PP_TUPLE_ELEM_O_2(n, tuple)
7c673cae
FG
43#
44# /* directly used elsewhere in Boost... */
45#
46# define BOOST_PP_TUPLE_ELEM_1_0(a) a
47#
48# define BOOST_PP_TUPLE_ELEM_2_0(a, b) a
49# define BOOST_PP_TUPLE_ELEM_2_1(a, b) b
50#
51# define BOOST_PP_TUPLE_ELEM_3_0(a, b, c) a
52# define BOOST_PP_TUPLE_ELEM_3_1(a, b, c) b
53# define BOOST_PP_TUPLE_ELEM_3_2(a, b, c) c
54#
55# endif