From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../libs/local_function/example/const_block.hpp | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/boost/libs/local_function/example/const_block.hpp (limited to 'src/boost/libs/local_function/example/const_block.hpp') diff --git a/src/boost/libs/local_function/example/const_block.hpp b/src/boost/libs/local_function/example/const_block.hpp new file mode 100644 index 000000000..904273410 --- /dev/null +++ b/src/boost/libs/local_function/example/const_block.hpp @@ -0,0 +1,58 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/local_function + +#ifndef CONST_BLOCK_HPP_ +#define CONST_BLOCK_HPP_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// PRIVATE // + +#define CONST_BLOCK_BIND_(r, unused, i, var) \ + BOOST_PP_COMMA_IF(i) const bind& var + +//[const_block_macro +#define CONST_BLOCK_(variables) \ + void BOOST_LOCAL_FUNCTION( \ + BOOST_PP_IIF(BOOST_PP_LIST_IS_NIL(variables), \ + void BOOST_PP_TUPLE_EAT(3) \ + , \ + BOOST_PP_LIST_FOR_EACH_I \ + )(CONST_BLOCK_BIND_, ~, variables) \ + ) +//] + +//[const_block_end_macro +#define CONST_BLOCK_END_(id) \ + BOOST_LOCAL_FUNCTION_NAME(BOOST_PP_CAT(const_block_, id)) \ + BOOST_PP_CAT(const_block_, id)(); /* call local function immediately */ +//] + +// PUBLIC // + +// Arguments `void | var1, var2, ... | (var1) (var2) ...`. +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS +# define CONST_BLOCK(void_or_seq) \ + CONST_BLOCK_(BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(void_or_seq)) +#else +# define CONST_BLOCK(...) \ + CONST_BLOCK_(BOOST_LOCAL_FUNCTION_DETAIL_PP_VOID_LIST(__VA_ARGS__)) +#endif + +#define CONST_BLOCK_END \ + CONST_BLOCK_END_(BOOST_LOCAL_FUNCTION_DETAIL_PP_LINE_COUNTER) + +#endif // #include guard + -- cgit v1.2.3