the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 99 lines 4.8 kB view raw
1// Copyright David Abrahams, Daniel Wallin 2003. Use, modification and 2// distribution is subject to the Boost Software License, Version 1.0. 3// (See accompanying file LICENSE_1_0.txt or copy at 4// http://www.boost.org/LICENSE_1_0.txt) 5 6#ifndef BOOST_PARAMETER_MACROS_050412_HPP 7#define BOOST_PARAMETER_MACROS_050412_HPP 8 9#include <boost/preprocessor/tuple/elem.hpp> 10#include <boost/preprocessor/repetition/repeat_from_to.hpp> 11#include <boost/preprocessor/arithmetic/inc.hpp> 12#include <boost/preprocessor/logical/bool.hpp> 13#include <boost/preprocessor/punctuation/comma_if.hpp> 14#include <boost/preprocessor/control/expr_if.hpp> 15#include <boost/preprocessor/repetition/enum_params.hpp> 16#include <boost/preprocessor/repetition/enum_binary_params.hpp> 17#include <boost/preprocessor/cat.hpp> 18#include <boost/detail/workaround.hpp> 19 20#define BOOST_PARAMETER_FUN_TEMPLATE_HEAD1(n) \ 21 template<BOOST_PP_ENUM_PARAMS(n, class T)> 22 23#define BOOST_PARAMETER_FUN_TEMPLATE_HEAD0(n) 24 25#if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592)) 26 27# define BOOST_PARAMETER_MATCH_TYPE(n, param) \ 28 BOOST_PP_EXPR_IF(n, typename) param::match \ 29 < \ 30 BOOST_PP_ENUM_PARAMS(n, T) \ 31 >::type 32 33#else 34 35# define BOOST_PARAMETER_MATCH_TYPE(n, param) param 36 37#endif 38 39#define BOOST_PARAMETER_FUN_DECL(z, n, params) \ 40 \ 41 BOOST_PP_CAT(BOOST_PARAMETER_FUN_TEMPLATE_HEAD, BOOST_PP_BOOL(n))(n) \ 42 \ 43 BOOST_PP_TUPLE_ELEM(3, 0, params) \ 44 BOOST_PP_TUPLE_ELEM(3, 1, params)( \ 45 BOOST_PP_ENUM_BINARY_PARAMS(n, T, const& p) \ 46 BOOST_PP_COMMA_IF(n) \ 47 BOOST_PARAMETER_MATCH_TYPE(n,BOOST_PP_TUPLE_ELEM(3, 2, params)) \ 48 kw = BOOST_PP_TUPLE_ELEM(3, 2, params)() \ 49 ) \ 50 { \ 51 return BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(3, 1, params), _with_named_params)( \ 52 kw(BOOST_PP_ENUM_PARAMS(n, p)) \ 53 ); \ 54 } 55 56// Generates: 57// 58// template<class Params> 59// ret name ## _with_named_params(Params const&); 60// 61// template<class T0> 62// ret name(T0 const& p0, typename parameters::match<T0>::type kw = parameters()) 63// { 64// return name ## _with_named_params(kw(p0)); 65// } 66// 67// template<class T0, ..., class TN> 68// ret name(T0 const& p0, ..., TN const& PN 69// , typename parameters::match<T0, ..., TN>::type kw = parameters()) 70// { 71// return name ## _with_named_params(kw(p0, ..., pN)); 72// } 73// 74// template<class Params> 75// ret name ## _with_named_params(Params const&) 76// 77// lo and hi determines the min and max arity of the generated functions. 78 79#define BOOST_PARAMETER_FUN(ret, name, lo, hi, parameters) \ 80 \ 81 template<class Params> \ 82 ret BOOST_PP_CAT(name, _with_named_params)(Params const& p); \ 83 \ 84 BOOST_PP_REPEAT_FROM_TO( \ 85 lo, BOOST_PP_INC(hi), BOOST_PARAMETER_FUN_DECL, (ret, name, parameters)) \ 86 \ 87 template<class Params> \ 88 ret BOOST_PP_CAT(name, _with_named_params)(Params const& p) 89 90#define BOOST_PARAMETER_MEMFUN(ret, name, lo, hi, parameters) \ 91 \ 92 BOOST_PP_REPEAT_FROM_TO( \ 93 lo, BOOST_PP_INC(hi), BOOST_PARAMETER_FUN_DECL, (ret, name, parameters)) \ 94 \ 95 template<class Params> \ 96 ret BOOST_PP_CAT(name, _with_named_params)(Params const& p) 97 98#endif // BOOST_PARAMETER_MACROS_050412_HPP 99