├── doc
├── html
│ ├── vellipsis.gif
│ └── rst.css
└── Jamfile.v2
├── test
├── literate
│ ├── headers-and-namespaces0.cpp
│ ├── README
│ ├── required-parameters0.cpp
│ ├── defining-the-keywords0.cpp
│ ├── template-keywords0.cpp
│ ├── class-template-skeleton0.cpp
│ ├── template-keywords1.cpp
│ ├── fine-grained-name-control0.cpp
│ ├── parameter-enabled-member-functions1.cpp
│ ├── extracting-parameter-types1.cpp
│ ├── defining-the-keywords1.cpp
│ ├── static-member-functions0.cpp
│ ├── namespaces0.cpp
│ ├── namespaces2.cpp
│ ├── namespaces1.cpp
│ ├── parameter-enabled-function-call-operators0.cpp
│ ├── parameter-enabled-member-functions0.cpp
│ ├── namespaces3.cpp
│ ├── lazy-default-computation0.cpp
│ ├── optional-parameters0.cpp
│ ├── handling-out-parameters0.cpp
│ ├── parameter-enabled-constructors0.cpp
│ ├── lazy-default-computation1.cpp
│ ├── default-expression-evaluation0.cpp
│ ├── top-level0.cpp
│ ├── extracting-parameter-types0.cpp
│ ├── writing-the-function0.cpp
│ ├── building-argumentpacks0.cpp
│ └── deduced-parameters0.cpp
├── duplicates.cpp
├── deduced_unmatched_arg.cpp
├── maybe.cpp
├── tutorial.cpp
├── CMakeLists.txt
├── macros.cpp
├── timer.hpp
├── optional_deduced_sfinae.cpp
├── timings.txt
├── basics.cpp
├── earwicker.cpp
├── function_type_tpl_param.cpp
├── deduced.hpp
├── basics.hpp
└── sfinae.cpp
├── config
├── Jamfile.v2
└── graph_supported.cpp
├── include
└── boost
│ ├── parameter
│ ├── aux_
│ │ ├── cast.hpp
│ │ ├── preprocessor
│ │ │ ├── flatten.hpp
│ │ │ ├── for_each.hpp
│ │ │ ├── nullptr.hpp
│ │ │ ├── seq_enum.hpp
│ │ │ ├── no_perfect_forwarding_end.hpp
│ │ │ ├── impl
│ │ │ │ ├── argument_specs.hpp
│ │ │ │ ├── function_dispatch_tuple.hpp
│ │ │ │ ├── parenthesized_type.hpp
│ │ │ │ ├── function_forward_match.hpp
│ │ │ │ ├── arity_range.hpp
│ │ │ │ ├── split_args.hpp
│ │ │ │ └── parenthesized_return_type.hpp
│ │ │ ├── is_binary.hpp
│ │ │ ├── is_nullary.hpp
│ │ │ ├── convert_binary_seq.hpp
│ │ │ ├── binary_seq_to_args.hpp
│ │ │ ├── inc_binary_seq.hpp
│ │ │ ├── qualifier.hpp
│ │ │ └── overloads.hpp
│ │ ├── parameter_requirements.hpp
│ │ ├── parenthesized_type.hpp
│ │ ├── use_default.hpp
│ │ ├── lambda_tag.hpp
│ │ ├── as_lvalue.hpp
│ │ ├── pack
│ │ │ ├── insert_tagged.hpp
│ │ │ ├── tag_keyword_arg.hpp
│ │ │ ├── parameter_requirements.hpp
│ │ │ ├── tag_template_keyword_arg.hpp
│ │ │ ├── deduced_item.hpp
│ │ │ ├── unmatched_argument.hpp
│ │ │ ├── as_parameter_requirements.hpp
│ │ │ ├── is_named_argument.hpp
│ │ │ ├── item.hpp
│ │ │ ├── make_items.hpp
│ │ │ ├── make_deduced_items.hpp
│ │ │ ├── tag_deduced.hpp
│ │ │ ├── tag_keyword_arg_ref.hpp
│ │ │ ├── tag_type.hpp
│ │ │ └── predicate.hpp
│ │ ├── use_default_tag.hpp
│ │ ├── void.hpp
│ │ ├── tagged_argument_fwd.hpp
│ │ ├── always_true_predicate.hpp
│ │ ├── is_maybe.hpp
│ │ ├── yesno.hpp
│ │ ├── result_of0.hpp
│ │ ├── is_placeholder.hpp
│ │ ├── pp_impl
│ │ │ ├── match.hpp
│ │ │ ├── unwrap_predicate.hpp
│ │ │ └── argument_pack.hpp
│ │ ├── template_keyword.hpp
│ │ ├── name.hpp
│ │ ├── is_tagged_argument.hpp
│ │ ├── set.hpp
│ │ ├── has_nested_template_fn.hpp
│ │ ├── default.hpp
│ │ └── maybe.hpp
│ ├── keyword_fwd.hpp
│ ├── is_argument_pack.hpp
│ ├── match.hpp
│ ├── required.hpp
│ ├── optional.hpp
│ ├── template_keyword.hpp
│ ├── preprocessor_no_spec.hpp
│ ├── config.hpp
│ └── deduced.hpp
│ └── parameter.hpp
├── index.html
├── meta
└── libraries.json
├── CMakeLists.txt
├── README.md
├── appveyor.yml
└── .gitattributes
/doc/html/vellipsis.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/boostorg/parameter/HEAD/doc/html/vellipsis.gif
--------------------------------------------------------------------------------
/test/literate/headers-and-namespaces0.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | using boost::parameter::keyword;
3 |
4 |
--------------------------------------------------------------------------------
/test/literate/README:
--------------------------------------------------------------------------------
1 | These tests were extracted from the Boost.Parameter documentation
2 | with:
3 |
4 | python ../../../../tools/litre/tool.py \
5 | ../../../../libs/parameter/doc/index.rst \
6 | --dump_dir=.
7 |
--------------------------------------------------------------------------------
/test/literate/required-parameters0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | BOOST_PARAMETER_NAME(graph)
5 |
6 | BOOST_PARAMETER_FUNCTION(
7 | (void), f, tag, (required (graph, *) )
8 | )
9 | {
10 | }
11 |
12 |
--------------------------------------------------------------------------------
/config/Jamfile.v2:
--------------------------------------------------------------------------------
1 | # Copyright Andrey Semashev 2025.
2 | #
3 | # Distributed under the Boost Software License, Version 1.0.
4 | # (See accompanying file LICENSE_1_0.txt or copy at
5 | # http://www.boost.org/LICENSE_1_0.txt)
6 |
7 | exe graph_supported : graph_supported.cpp : /boost/graph//boost_graph ;
8 | explicit graph_supported ;
9 |
--------------------------------------------------------------------------------
/test/literate/defining-the-keywords0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace graphs {
5 |
6 | BOOST_PARAMETER_NAME(graph) // Note: no semicolon
7 | BOOST_PARAMETER_NAME(visitor)
8 | BOOST_PARAMETER_NAME(root_vertex)
9 | BOOST_PARAMETER_NAME(index_map)
10 | BOOST_PARAMETER_NAME(color_map)
11 | }
12 |
--------------------------------------------------------------------------------
/test/literate/template-keywords0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace boost { namespace python {
5 |
6 | BOOST_PARAMETER_TEMPLATE_KEYWORD(class_type)
7 | BOOST_PARAMETER_TEMPLATE_KEYWORD(base_list)
8 | BOOST_PARAMETER_TEMPLATE_KEYWORD(held_type)
9 | BOOST_PARAMETER_TEMPLATE_KEYWORD(copyable)
10 | }}
11 |
12 |
--------------------------------------------------------------------------------
/test/literate/class-template-skeleton0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace boost { namespace python {
5 |
6 | template <
7 | typename A0
8 | , typename A1 = boost::parameter::void_
9 | , typename A2 = boost::parameter::void_
10 | , typename A3 = boost::parameter::void_
11 | >
12 | struct class_
13 | {
14 | };
15 | }}
16 |
17 |
--------------------------------------------------------------------------------
/test/literate/template-keywords1.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace boost { namespace python {
5 |
6 | namespace tag {
7 |
8 | struct class_type; // keyword tag type
9 | }
10 |
11 | template
12 | struct class_type
13 | : boost::parameter::template_keyword
14 | {
15 | };
16 | }}
17 |
18 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/cast.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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_CAST_060902_HPP
7 | #define BOOST_PARAMETER_CAST_060902_HPP
8 |
9 | #include
10 |
11 | #endif // include guard
12 |
13 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/flatten.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2005.
2 | // Distributed under 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_FLATTEN_051217_HPP
7 | #define BOOST_PARAMETER_FLATTEN_051217_HPP
8 |
9 | #include
10 |
11 | #endif // include guard
12 |
13 |
--------------------------------------------------------------------------------
/test/literate/fine-grained-name-control0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | BOOST_PARAMETER_NAME((pass_foo, keywords) foo)
5 |
6 | BOOST_PARAMETER_FUNCTION(
7 | (int), f, keywords, (required (foo, *))
8 | )
9 | {
10 | return foo + 1;
11 | }
12 |
13 | #include
14 |
15 | int main()
16 | {
17 | int x = f(pass_foo = 41);
18 | BOOST_TEST_EQ(x, 42);
19 | return boost::report_errors();
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/for_each.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2005.
2 | // Distributed under 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_FOR_EACH_051217_HPP
7 | #define BOOST_PARAMETER_FOR_EACH_051217_HPP
8 |
9 | #include
10 |
11 | #endif // include guard
12 |
13 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | Automatically loading index page... if nothing happens, please go to
10 | doc/html/index.html.
11 |
12 |
13 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/parameter_requirements.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin, David Abrahams 2005.
2 | // Distributed under 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_AUX_PARAMETER_REQUIREMENTS_HPP
7 | #define BOOST_PARAMETER_AUX_PARAMETER_REQUIREMENTS_HPP
8 |
9 | #include
10 |
11 | #endif // include guard
12 |
13 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/parenthesized_type.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams 2006.
2 | // Distributed under 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_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP
7 | #define BOOST_PARAMETER_AUX_PARENTHESIZED_TYPE_DWA2006414_HPP
8 |
9 | #include
10 |
11 | #endif // include guard
12 |
13 |
--------------------------------------------------------------------------------
/test/literate/parameter-enabled-member-functions1.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | BOOST_PARAMETER_NAME(arg1)
5 | BOOST_PARAMETER_NAME(arg2)
6 |
7 | using namespace boost::parameter;
8 |
9 | struct callable2
10 | {
11 | BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
12 | (void), call, tag, (required (arg1,(int))(arg2,(int)))
13 | )
14 | {
15 | call_impl(arg1, arg2);
16 | }
17 |
18 | private:
19 | void call_impl(int, int); // implemented elsewhere.
20 | };
21 |
22 |
--------------------------------------------------------------------------------
/meta/libraries.json:
--------------------------------------------------------------------------------
1 | {
2 | "key": "parameter",
3 | "name": "Parameter",
4 | "authors": [
5 | "David Abrahams",
6 | "Daniel Wallin"
7 | ],
8 | "description": "Boost.Parameter Library - Write functions that accept arguments by name.",
9 | "category": [
10 | "Emulation",
11 | "Programming"
12 | ],
13 | "maintainers": [
14 | "David Abrahams ",
15 | "Daniel Wallin "
16 | ],
17 | "cxxstd": "03"
18 | }
19 |
--------------------------------------------------------------------------------
/test/literate/extracting-parameter-types1.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | BOOST_PARAMETER_NAME(index)
5 |
6 | template
7 | typename boost::parameter::value_type::type
8 | twice_index(ArgumentPack const& args)
9 | {
10 | return 2 * args[_index|42];
11 | }
12 |
13 | #include
14 |
15 | int main()
16 | {
17 | int six = twice_index(_index = 3);
18 | BOOST_TEST_EQ(six, 6);
19 | return boost::report_errors();
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/test/literate/defining-the-keywords1.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace graphs {
5 | namespace tag {
6 |
7 | // keyword tag type
8 | struct graph
9 | {
10 | typedef boost::parameter::forward_reference qualifier;
11 | };
12 | }
13 |
14 | namespace // unnamed
15 | {
16 | // A reference to the keyword object
17 | boost::parameter::keyword const& _graph
18 | = boost::parameter::keyword::instance;
19 | }
20 | }
21 |
22 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/use_default.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_USE_DEFAULT_HPP
7 | #define BOOST_PARAMETER_AUX_USE_DEFAULT_HPP
8 |
9 | namespace boost { namespace parameter { namespace aux {
10 |
11 | struct use_default
12 | {
13 | };
14 | }}} // namespace boost::parameter::aux
15 |
16 | #endif // include guard
17 |
18 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/lambda_tag.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_LAMBDA_TAG_HPP
7 | #define BOOST_PARAMETER_AUX_LAMBDA_TAG_HPP
8 |
9 | namespace boost { namespace parameter { namespace aux {
10 |
11 | // Tag type passed to MPL lambda.
12 | struct lambda_tag;
13 | }}} // namespace boost::parameter::aux
14 |
15 | #endif // include guard
16 |
17 |
--------------------------------------------------------------------------------
/test/literate/static-member-functions0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | using namespace boost::parameter;
6 |
7 | BOOST_PARAMETER_NAME(arg1)
8 |
9 | struct somebody
10 | {
11 | BOOST_PARAMETER_MEMBER_FUNCTION(
12 | (void), static f, tag, (optional (arg1,(int),0))
13 | )
14 | {
15 | std::cout << arg1 << std::endl;
16 | }
17 | };
18 |
19 | #include
20 |
21 | int main()
22 | {
23 | somebody::f();
24 | somebody::f(4);
25 | return boost::report_errors();
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/nullptr.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Cromwell D. Enage 2019.
2 | // Distributed under 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_AUX_PREPROCESSOR_NULLPTR_HPP
7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_NULLPTR_HPP
8 |
9 | #include
10 |
11 | #if defined(BOOST_NO_CXX11_NULLPTR)
12 | #define BOOST_PARAMETER_AUX_PP_NULLPTR 0
13 | #else
14 | #define BOOST_PARAMETER_AUX_PP_NULLPTR nullptr
15 | #endif
16 |
17 | #endif // include guard
18 |
19 |
--------------------------------------------------------------------------------
/test/literate/namespaces0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | namespace lib {
6 |
7 | BOOST_PARAMETER_NAME(name)
8 | BOOST_PARAMETER_NAME(index)
9 |
10 | BOOST_PARAMETER_FUNCTION(
11 | (int), f, tag, (optional (name,*,"bob")(index,(int),1))
12 | )
13 | {
14 | std::cout << name << ":" << index << std::endl;
15 | return index;
16 | }
17 | }
18 |
19 | #include
20 |
21 | int main()
22 | {
23 | int x = lib::f(lib::_name = "jill", lib::_index = 1);
24 | BOOST_TEST_EQ(x, 1);
25 | return boost::report_errors();
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/test/literate/namespaces2.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | namespace lib {
6 |
7 | BOOST_PARAMETER_NAME(name)
8 | BOOST_PARAMETER_NAME(index)
9 |
10 | BOOST_PARAMETER_FUNCTION(
11 | (int), f, tag, (optional (name,*,"bob")(index,(int),1))
12 | )
13 | {
14 | std::cout << name << ":" << index << std::endl;
15 | return index;
16 | }
17 | }
18 |
19 | #include
20 |
21 | using namespace lib;
22 |
23 | int main()
24 | {
25 | int x = f(_name = "jill", _index = 3);
26 | BOOST_TEST_EQ(x, 3);
27 | return boost::report_errors();
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/test/duplicates.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2005.
2 | // Distributed under 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 | #include
7 | #include "basics.hpp"
8 |
9 | namespace test {
10 |
11 | template
12 | void f(Params const &)
13 | {
14 | }
15 | }
16 |
17 | int main()
18 | {
19 | test::f((
20 | test::_name = 1
21 | , test::_value = 1
22 | , test::_index = 1
23 | , test::_tester = 1
24 | , test::_value = 1 // repeated keyword: should not compile
25 | ));
26 | return 0;
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/test/literate/namespaces1.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | namespace lib {
6 |
7 | BOOST_PARAMETER_NAME(name)
8 | BOOST_PARAMETER_NAME(index)
9 |
10 | BOOST_PARAMETER_FUNCTION(
11 | (int), f, tag, (optional (name,*,"bob")(index,(int),1))
12 | )
13 | {
14 | std::cout << name << ":" << index << std::endl;
15 | return index;
16 | }
17 | }
18 |
19 | #include
20 |
21 | using lib::_name;
22 | using lib::_index;
23 |
24 | int main()
25 | {
26 | int x = lib::f(_name = "jill", _index = 1);
27 | BOOST_TEST_EQ(x, 1);
28 | return boost::report_errors();
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/config/graph_supported.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright Andrey Semashev 2025.
3 | * Distributed under the Boost Software License, Version 1.0.
4 | * (See accompanying file LICENSE_1_0.txt or copy at
5 | * http://www.boost.org/LICENSE_1_0.txt)
6 | */
7 |
8 | // This test checks whether the portion of Boost.Graph that is used by Boost.Parameter tests
9 | // is compatible with the current compiler. The headers listed below are used in Boost.Parameter tests.
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | int main()
17 | {
18 | }
19 |
--------------------------------------------------------------------------------
/test/literate/parameter-enabled-function-call-operators0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | using namespace boost::parameter;
6 |
7 | BOOST_PARAMETER_NAME(arg1)
8 | BOOST_PARAMETER_NAME(arg2)
9 |
10 | struct callable2
11 | {
12 | BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(
13 | (void), tag, (required (arg1,(int))(arg2,(int)))
14 | )
15 | {
16 | std::cout << arg1 << ", " << arg2 << std::endl;
17 | }
18 | };
19 |
20 | #include
21 |
22 | int main()
23 | {
24 | callable2 c2;
25 | callable2 const& c2_const = c2;
26 | c2_const(1, 2);
27 | return boost::report_errors();
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/test/literate/parameter-enabled-member-functions0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | using namespace boost::parameter;
6 |
7 | BOOST_PARAMETER_NAME(arg1)
8 | BOOST_PARAMETER_NAME(arg2)
9 |
10 | struct callable2
11 | {
12 | BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
13 | (void), call, tag, (required (arg1,(int))(arg2,(int)))
14 | )
15 | {
16 | std::cout << arg1 << ", " << arg2 << std::endl;
17 | }
18 | };
19 |
20 | #include
21 |
22 | int main()
23 | {
24 | callable2 c2;
25 | callable2 const& c2_const = c2;
26 | c2_const.call(1, 2);
27 | return boost::report_errors();
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/as_lvalue.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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_AUX_AS_LVALUE_HPP
7 | #define BOOST_PARAMETER_AUX_AS_LVALUE_HPP
8 |
9 | namespace boost { namespace parameter { namespace aux {
10 |
11 | template
12 | T const& as_lvalue(T const& value)
13 | {
14 | return value;
15 | }
16 |
17 | template
18 | T& as_lvalue(T& value)
19 | {
20 | return value;
21 | }
22 | }}} // namespace boost::parameter::aux
23 |
24 | #endif // include guard
25 |
26 |
--------------------------------------------------------------------------------
/test/literate/namespaces3.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | namespace lib {
6 | namespace keywords {
7 |
8 | BOOST_PARAMETER_NAME(name)
9 | BOOST_PARAMETER_NAME(index)
10 | }
11 |
12 | BOOST_PARAMETER_FUNCTION(
13 | (int), f, keywords::tag, (optional (name,*,"bob")(index,(int),1))
14 | )
15 | {
16 | std::cout << name << ":" << index << std::endl;
17 | return index;
18 | }
19 | }
20 |
21 | #include
22 |
23 | using namespace lib::keywords;
24 |
25 | int main()
26 | {
27 | int x = lib::f(_name = "bob", _index = 2);
28 | BOOST_TEST_EQ(x, 2);
29 | return boost::report_errors();
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/include/boost/parameter/keyword_fwd.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Cromwell D. Enage 2017.
2 | // Distributed under 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_KEYWORD_FWD_HPP
7 | #define BOOST_PARAMETER_KEYWORD_FWD_HPP
8 |
9 | namespace boost { namespace parameter {
10 |
11 | struct in_reference;
12 | struct out_reference;
13 | typedef ::boost::parameter::out_reference in_out_reference;
14 | struct forward_reference;
15 | struct consume_reference;
16 | typedef ::boost::parameter::consume_reference move_from_reference;
17 |
18 | template
19 | struct keyword;
20 | }} // namespace boost::parameter
21 |
22 | #endif // include guard
23 |
24 |
--------------------------------------------------------------------------------
/test/literate/lazy-default-computation0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | BOOST_PARAMETER_NAME(s1)
6 | BOOST_PARAMETER_NAME(s2)
7 | BOOST_PARAMETER_NAME(s3)
8 |
9 | template
10 | std::string f(ArgumentPack const& args)
11 | {
12 | std::string const& s1 = args[_s1];
13 | std::string const& s2 = args[_s2];
14 | typename boost::parameter::binding<
15 | ArgumentPack,tag::s3,std::string
16 | >::type s3 = args[_s3|(s1+s2)]; // always constructs s1+s2
17 | return s3;
18 | }
19 |
20 | #include
21 |
22 | int main()
23 | {
24 | std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
25 | BOOST_TEST_EQ(x, std::string("hi world"));
26 | return boost::report_errors();
27 | }
28 |
29 |
--------------------------------------------------------------------------------
/test/deduced_unmatched_arg.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | BOOST_PARAMETER_NAME(x)
14 |
15 | int main()
16 | {
17 | boost::parameter::parameters<
18 | boost::parameter::optional<
19 | boost::parameter::deduced
20 | , boost::is_convertible
21 | >
22 | >()("foo");
23 | return 0;
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/test/literate/optional-parameters0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace boost {
5 |
6 | int vertex_index = 0;
7 |
8 | template
9 | struct dfs_visitor
10 | {
11 | };
12 | }
13 |
14 | BOOST_PARAMETER_NAME(graph)
15 | BOOST_PARAMETER_NAME(visitor)
16 | BOOST_PARAMETER_NAME(root_vertex)
17 | BOOST_PARAMETER_NAME(index_map)
18 | BOOST_PARAMETER_NAME(in_out(color_map))
19 |
20 | BOOST_PARAMETER_FUNCTION((void), f, tag,
21 | (required (graph, *))
22 | (optional
23 | (visitor, *, boost::dfs_visitor<>())
24 | (root_vertex, *, *vertices(graph).first)
25 | (index_map, *, get(boost::vertex_index,graph))
26 | (color_map, *,
27 | default_color_map(num_vertices(graph), index_map)
28 | )
29 | )
30 | )
31 | {
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/doc/html/rst.css:
--------------------------------------------------------------------------------
1 | /* Copyright David Abrahams 2006. Distributed under the Boost
2 | Software License, Version 1.0. (See accompanying
3 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 | */
5 |
6 | @import "../../../../rst.css";
7 |
8 | div.section div.section div.section dl {
9 | margin-left: 2em;
10 | }
11 |
12 | td span {
13 | vertical-align: text-top;
14 | }
15 |
16 | img {
17 | border: none;
18 | vertical-align: middle
19 | }
20 |
21 | span.vellipsis {
22 | display: block;
23 | width: 5px;
24 | height: 22px;
25 | background: url("vellipsis.gif");
26 | margin-left: 3em;
27 | text-indent: -1000px;
28 | }
29 |
30 |
31 | PRE
32 | {
33 | FONT-FAMILY: monospace ;
34 | }
35 |
36 | CODE
37 | {
38 | FONT-FAMILY: monospace;
39 | }
40 | .pre
41 | {
42 | FONT-FAMILY: monospace;
43 | }
44 |
--------------------------------------------------------------------------------
/test/literate/handling-out-parameters0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace boost {
5 |
6 | int vertex_index = 0;
7 |
8 | template
9 | struct dfs_visitor
10 | {
11 | };
12 | }
13 |
14 | BOOST_PARAMETER_NAME(graph)
15 | BOOST_PARAMETER_NAME(visitor)
16 | BOOST_PARAMETER_NAME(root_vertex)
17 | BOOST_PARAMETER_NAME(index_map)
18 | BOOST_PARAMETER_NAME(in_out(color_map))
19 |
20 | BOOST_PARAMETER_FUNCTION((void), f, tag,
21 | (required (graph, *))
22 | (optional
23 | (visitor, *, boost::dfs_visitor<>())
24 | (root_vertex, *, *vertices(graph).first)
25 | (index_map, *, get(boost::vertex_index,graph))
26 | (color_map, *,
27 | default_color_map(num_vertices(graph), index_map)
28 | )
29 | )
30 | )
31 | {
32 | }
33 |
34 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/insert_tagged.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_INSERT_TAGGED_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_INSERT_TAGGED_HPP
8 |
9 | #include
10 |
11 | namespace boost { namespace parameter { namespace aux {
12 |
13 | // Inserts Tagged::key_type into the UserArgs set.
14 | // Extra indirection to lazily evaluate Tagged::key_type.
15 | template
16 | struct insert_tagged
17 | : ::boost::parameter::aux::insert_
18 | {
19 | };
20 | }}} // namespace boost::parameter::aux
21 |
22 | #endif // include guard
23 |
24 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/use_default_tag.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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_USE_DEFAULT_TAG_HPP
7 | #define BOOST_PARAMETER_USE_DEFAULT_TAG_HPP
8 |
9 | #include
10 |
11 | namespace boost { namespace parameter { namespace aux {
12 |
13 | struct use_default_tag
14 | {
15 | inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(use_default_tag(), {})
16 |
17 | inline BOOST_CONSTEXPR BOOST_DEFAULTED_FUNCTION(
18 | use_default_tag(use_default_tag const&), {}
19 | )
20 |
21 | inline BOOST_CONSTEXPR use_default_tag operator()() const
22 | {
23 | return *this;
24 | }
25 | };
26 | }}} // namespace boost::parameter::aux
27 |
28 | #endif // include guard
29 |
30 |
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Generated by `boostdep --cmake parameter`
2 | # Copyright 2020 Peter Dimov
3 | # Distributed under the Boost Software License, Version 1.0.
4 | # https://www.boost.org/LICENSE_1_0.txt
5 |
6 | cmake_minimum_required(VERSION 3.5...3.16)
7 |
8 | project(boost_parameter VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
9 |
10 | add_library(boost_parameter INTERFACE)
11 | add_library(Boost::parameter ALIAS boost_parameter)
12 |
13 | target_include_directories(boost_parameter INTERFACE include)
14 |
15 | target_link_libraries(boost_parameter
16 | INTERFACE
17 | Boost::config
18 | Boost::core
19 | Boost::function
20 | Boost::fusion
21 | Boost::mp11
22 | Boost::mpl
23 | Boost::optional
24 | Boost::preprocessor
25 | Boost::type_traits
26 | Boost::utility
27 | )
28 |
29 | if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
30 |
31 | add_subdirectory(test)
32 |
33 | endif()
34 |
35 |
--------------------------------------------------------------------------------
/doc/Jamfile.v2:
--------------------------------------------------------------------------------
1 | # Copyright David Abrahams 2006. Distributed under the Boost
2 | # Software License, Version 1.0. (See accompanying
3 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4 |
5 | import docutils ;
6 |
7 | sources = [ glob *.rst ] ;
8 | bases = $(sources:S=) ;
9 |
10 | # This is a path relative to the html/ subdirectory where the
11 | # generated output will eventually be moved.
12 | stylesheet = "--stylesheet=rst.css" ;
13 |
14 | for local b in $(bases)
15 | {
16 | html $(b) : $(b).rst :
17 |
18 | #
19 | "-gdt --link-stylesheet --traceback --trim-footnote-reference-space --footnote-references=superscript "$(stylesheet)
20 | ;
21 | }
22 |
23 | alias htmls : $(bases) ;
24 | stage html : $(bases) ;
25 |
26 | ###############################################################################
27 | alias boostdoc ;
28 | explicit boostdoc ;
29 | alias boostrelease : html ;
30 | explicit boostrelease ;
31 |
--------------------------------------------------------------------------------
/include/boost/parameter/is_argument_pack.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Cromwell D. Enage 2018.
2 | // Distributed under 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_IS_ARGUMENT_PACK_HPP
7 | #define BOOST_PARAMETER_IS_ARGUMENT_PACK_HPP
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | namespace boost { namespace parameter {
16 |
17 | template
18 | struct is_argument_pack
19 | : ::boost::mpl::if_<
20 | ::boost::is_base_of< ::boost::parameter::aux::empty_arg_list,T>
21 | , ::boost::mpl::true_
22 | , ::boost::parameter::aux::is_tagged_argument
23 | >::type
24 | {
25 | };
26 | }}
27 |
28 | #endif // include guard
29 |
30 |
--------------------------------------------------------------------------------
/test/literate/parameter-enabled-constructors0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | BOOST_PARAMETER_NAME(name)
6 | BOOST_PARAMETER_NAME(index)
7 |
8 | struct myclass_impl
9 | {
10 | template
11 | myclass_impl(ArgumentPack const& args)
12 | {
13 | std::cout << "name = " << args[_name];
14 | std::cout << "; index = " << args[_index | 42];
15 | std::cout << std::endl;
16 | }
17 | };
18 |
19 | struct myclass : myclass_impl
20 | {
21 | BOOST_PARAMETER_CONSTRUCTOR(
22 | myclass, (myclass_impl), tag
23 | , (required (name,*)) (optional (index,*))
24 | ) // no semicolon
25 | };
26 |
27 | #include
28 |
29 | int main()
30 | {
31 | myclass x("bob", 3); // positional
32 | myclass y(_index = 12, _name = "sally"); // named
33 | myclass z("june"); // positional/defaulted
34 | return boost::report_errors();
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/test/literate/lazy-default-computation1.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | BOOST_PARAMETER_NAME(s1)
9 | BOOST_PARAMETER_NAME(s2)
10 | BOOST_PARAMETER_NAME(s3)
11 |
12 | template
13 | std::string f(ArgumentPack const& args)
14 | {
15 | std::string const& s1 = args[_s1];
16 | std::string const& s2 = args[_s2];
17 | typename boost::parameter::binding<
18 | ArgumentPack, tag::s3, std::string
19 | >::type s3 = args[
20 | _s3 || boost::bind(
21 | std::plus()
22 | , boost::ref(s1)
23 | , boost::ref(s2)
24 | )
25 | ];
26 | return s3;
27 | }
28 |
29 | #include
30 |
31 | int main()
32 | {
33 | std::string x = f((_s1="hello,", _s2=" world", _s3="hi world"));
34 | BOOST_TEST_EQ(x, std::string("hi world"));
35 | return boost::report_errors();
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/seq_enum.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams 2005.
2 | // Distributed under 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_AUX_PREPROCESSOR_SEQ_ENUM_HPP
7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_SEQ_ENUM_HPP
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #if BOOST_WORKAROUND(__MWERKS__, <= 0x3003)
14 | #include
15 | // Temporary version of BOOST_PP_SEQ_ENUM
16 | // until Paul M. integrates the workaround.
17 | #define BOOST_PARAMETER_SEQ_ENUM_I(size, seq) \
18 | BOOST_PP_CAT(BOOST_PP_SEQ_ENUM_, size) seq
19 | #define BOOST_PARAMETER_SEQ_ENUM(seq) \
20 | BOOST_PARAMETER_SEQ_ENUM_I(BOOST_PP_SEQ_SIZE(seq), seq)
21 | #else
22 | #define BOOST_PARAMETER_SEQ_ENUM(seq) BOOST_PP_SEQ_ENUM(seq)
23 | #endif
24 |
25 | #endif // include guard
26 |
27 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/tag_keyword_arg.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_TAG_KEYWORD_ARG_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_TAG_KEYWORD_ARG_HPP
8 |
9 | #include
10 | #include
11 |
12 | namespace boost { namespace parameter { namespace aux {
13 |
14 | struct tag_keyword_arg
15 | {
16 | template
17 | struct apply
18 | {
19 | typedef typename ::boost::parameter::aux::tag::type type;
20 | };
21 |
22 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
23 | template
24 | using fn = typename ::boost::parameter::aux::tag::type;
25 | #endif
26 | };
27 | }}} // namespace boost::parameter::aux
28 |
29 | #endif // include guard
30 |
31 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/parameter_requirements.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin, David Abrahams 2005.
2 | // Distributed under 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_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_PARAMETER_REQUIREMENTS_HPP
8 |
9 | namespace boost { namespace parameter { namespace aux {
10 |
11 | // Used to pass static information about parameter requirements through
12 | // the satisfies() overload set (below). The matched function is never
13 | // invoked, but its type indicates whether a parameter matches at
14 | // compile-time.
15 | template
16 | struct parameter_requirements
17 | {
18 | typedef Keyword keyword;
19 | typedef Predicate predicate;
20 | typedef HasDefault has_default;
21 | };
22 | }}} // namespace boost::parameter::aux
23 |
24 | #endif // include guard
25 |
26 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/tag_template_keyword_arg.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_TAG_TEMPLATE_KEYWORD_ARG_HPP
8 |
9 | #include
10 | #include
11 |
12 | namespace boost { namespace parameter { namespace aux {
13 |
14 | struct tag_template_keyword_arg
15 | {
16 | template
17 | struct apply
18 | {
19 | typedef ::boost::parameter::template_keyword type;
20 | };
21 |
22 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
23 | template
24 | using fn = ::boost::parameter::template_keyword;
25 | #endif
26 | };
27 | }}} // namespace boost::parameter::aux
28 |
29 | #endif // include guard
30 |
31 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/no_perfect_forwarding_end.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Copyright Cromwell D. Enage 2017.
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE_1_0.txt or copy at
5 | // http://www.boost.org/LICENSE_1_0.txt)
6 |
7 | // No include guard. This file is intended for multiple inclusion.
8 |
9 | #undef BOOST_PARAMETER_satisfies_begin
10 | #if (0 < BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY)
11 | #undef BOOST_PARAMETER_function_call_op_overload_R
12 | #undef BOOST_PARAMETER_function_call_arg_pack_init
13 | #undef BOOST_PARAMETER_function_call_arg_list_R
14 | #undef BOOST_PARAMETER_make_arg_items_R
15 | #endif
16 | #undef BOOST_PARAMETER_template_args
17 | #undef BOOST_PARAMETER_forward_typedef
18 | #undef BOOST_PARAMETER_build_deduced_list
19 | #undef BOOST_PARAMETER_make_deduced_list
20 | #undef BOOST_PARAMETER_build_arg_list
21 | #undef BOOST_PARAMETER_make_arg_list
22 | #undef BOOST_PARAMETER_satisfies_end
23 | #undef BOOST_PARAMETER_right_angle
24 |
25 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/impl/argument_specs.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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_AUX_PREPROCESSOR_IMPL_ARGUMENT_SPECS_HPP
7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_ARGUMENT_SPECS_HPP
8 |
9 | #include
10 |
11 | // Accessor macros for the argument specs tuple.
12 | #define BOOST_PARAMETER_FN_ARG_QUALIFIER(x) BOOST_PP_TUPLE_ELEM(4, 0, x)
13 | #define BOOST_PARAMETER_FN_ARG_KEYWORD(x) BOOST_PP_TUPLE_ELEM(4, 1, x)
14 | #define BOOST_PARAMETER_FN_ARG_PRED(x) BOOST_PP_TUPLE_ELEM(4, 2, x)
15 | #define BOOST_PARAMETER_FN_ARG_DEFAULT(x) BOOST_PP_TUPLE_ELEM(4, 3, x)
16 |
17 | #include
18 |
19 | #define BOOST_PARAMETER_FN_ARG_NAME(x) \
20 | BOOST_PARAMETER_UNQUALIFIED(BOOST_PARAMETER_FN_ARG_KEYWORD(x))
21 | /**/
22 |
23 | #endif // include guard
24 |
25 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/deduced_item.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_DEDUCED_ITEM_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_DEDUCED_ITEM_HPP
8 |
9 | #include
10 |
11 | namespace boost { namespace parameter { namespace aux {
12 |
13 | // A typelist that stored deduced parameter specs.
14 | template <
15 | typename ParameterSpec
16 | , typename Tail = ::boost::parameter::void_
17 | >
18 | struct deduced_item
19 | {
20 | typedef ParameterSpec spec;
21 | typedef Tail tail;
22 | };
23 |
24 | // Evaluate Tail and construct deduced_item list.
25 | template
26 | struct make_deduced_item
27 | {
28 | typedef ::boost::parameter::aux
29 | ::deduced_item type;
30 | };
31 | }}} // namespace boost::parameter::aux
32 |
33 | #endif // include guard
34 |
35 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/void.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin, David Abrahams 2005.
2 | // Distributed under 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_VOID_050329_HPP
7 | #define BOOST_PARAMETER_VOID_050329_HPP
8 |
9 | namespace boost { namespace parameter {
10 |
11 | // A placemarker for "no argument passed."
12 | // MAINTAINER NOTE: Do not make this into a metafunction
13 | struct void_
14 | {
15 | };
16 | }} // namespace boost::parameter
17 |
18 | namespace boost { namespace parameter { namespace aux {
19 |
20 | inline ::boost::parameter::void_& void_reference()
21 | {
22 | static ::boost::parameter::void_ instance;
23 | return instance;
24 | }
25 | }}} // namespace boost::parameter::aux
26 |
27 | #include
28 |
29 | #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
30 |
31 | namespace boost { namespace parameter { namespace aux {
32 |
33 | typedef void* voidstar;
34 | }}} // namespace boost::parameter::aux
35 |
36 | #endif
37 | #endif // include guard
38 |
39 |
--------------------------------------------------------------------------------
/test/maybe.cpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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 | #include
7 |
8 | namespace test {
9 |
10 | BOOST_PARAMETER_NAME(kw)
11 | BOOST_PARAMETER_NAME(unused)
12 |
13 | template
14 | int f(Args const& args)
15 | {
16 | return args[test::_kw | 1.f];
17 | }
18 | } // namespace test
19 |
20 | #include
21 | #include
22 |
23 | int main()
24 | {
25 | BOOST_TEST_EQ(0, test::f((test::_kw = 0, test::_unused = 0)));
26 | BOOST_TEST_EQ(1, test::f(test::_unused = 0));
27 | BOOST_TEST_EQ(
28 | 1
29 | , test::f((
30 | test::_kw = boost::parameter::aux::maybe()
31 | , test::_unused = 0
32 | ))
33 | );
34 | BOOST_TEST_EQ(
35 | 2
36 | , test::f((
37 | test::_kw = boost::parameter::aux::maybe(2)
38 | , test::_unused = 0
39 | ))
40 | );
41 | return boost::report_errors();
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/is_binary.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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_AUX_PREPROCESSOR_IS_BINARY_HPP
7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_IS_BINARY_HPP
8 |
9 | #include
10 | #include
11 |
12 | #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
13 | // From Paul Mensonides
14 | #include
15 | #include
16 | #define BOOST_PARAMETER_IS_BINARY(x) \
17 | BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_BINARY_C x BOOST_PP_COMMA() 0)
18 | /**/
19 | #include
20 | #include
21 | #define BOOST_PARAMETER_IS_BINARY_C(x,y) \
22 | ~, 1 BOOST_PP_RPAREN() \
23 | BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~
24 | /**/
25 | #else
26 | #include
27 | #define BOOST_PARAMETER_IS_BINARY(x) BOOST_PP_IS_BINARY(x)
28 | #endif
29 |
30 | #endif // include guard
31 |
32 |
--------------------------------------------------------------------------------
/include/boost/parameter.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2005.
2 | // Distributed under 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 | // See www.boost.org/libs/parameter for documentation.
7 |
8 | #ifndef BOOST_PARAMETER_050401_HPP
9 | #define BOOST_PARAMETER_050401_HPP
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | #endif // include guard
30 |
31 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/is_nullary.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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_AUX_PREPROCESSOR_IS_NULLARY_HPP
7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_IS_NULLARY_HPP
8 |
9 | #include
10 | #include
11 |
12 | #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
13 | // From Paul Mensonides
14 | #include
15 | #include
16 | #define BOOST_PARAMETER_IS_NULLARY(x) \
17 | BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_NULLARY_C x BOOST_PP_COMMA() 0)
18 | /**/
19 | #include
20 | #include
21 | #define BOOST_PARAMETER_IS_NULLARY_C() \
22 | ~, 1 BOOST_PP_RPAREN() \
23 | BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~
24 | /**/
25 | #else
26 | #include
27 | #define BOOST_PARAMETER_IS_NULLARY(x) BOOST_PP_IS_NULLARY(x)
28 | /**/
29 | #endif
30 |
31 | #endif // include guard
32 |
33 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/tagged_argument_fwd.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin, David Abrahams 2005.
2 | // Copyright Cromwell D. Enage 2017.
3 | // Distributed under the Boost Software License, Version 1.0.
4 | // (See accompanying file LICENSE_1_0.txt or copy at
5 | // http://www.boost.org/LICENSE_1_0.txt)
6 |
7 | #ifndef BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
8 | #define BOOST_PARAMETER_TAGGED_ARGUMENT_FWD_HPP
9 |
10 | namespace boost { namespace parameter { namespace aux {
11 |
12 | template
13 | class tagged_argument;
14 | }}} // namespace boost::parameter::aux
15 |
16 | #include
17 |
18 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
19 |
20 | namespace boost { namespace parameter { namespace aux {
21 |
22 | template
23 | struct tagged_argument_rref;
24 | }}} // namespace boost::parameter::aux
25 |
26 | #endif
27 |
28 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
29 |
30 | namespace boost { namespace parameter { namespace aux {
31 |
32 | template
33 | struct tagged_argument_list_of_1;
34 | }}} // namespace boost::parameter::aux
35 |
36 | #endif
37 | #endif // include guard
38 |
39 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/impl/function_dispatch_tuple.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin 2006.
2 | // Distributed under 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_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_TUPLE_HPP
7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_FUNCTION_DISPATCH_TUPLE_HPP
8 |
9 | #include
10 |
11 | // Accessor macros for the input tuple to the dispatch macros.
12 | #define BOOST_PARAMETER_FUNCTION_DISPATCH_BASE_NAME(x) \
13 | BOOST_PP_TUPLE_ELEM(5, 0, x)
14 | /**/
15 |
16 | #define BOOST_PARAMETER_FUNCTION_DISPATCH_SPLIT_ARGS(x) \
17 | BOOST_PP_TUPLE_ELEM(5, 1, x)
18 | /**/
19 |
20 | #define BOOST_PARAMETER_FUNCTION_DISPATCH_IS_MEMBER(x) \
21 | BOOST_PP_TUPLE_ELEM(5, 2, x)
22 | /**/
23 |
24 | #define BOOST_PARAMETER_FUNCTION_DISPATCH_IS_CONST(x) \
25 | BOOST_PP_TUPLE_ELEM(5, 3, x)
26 | /**/
27 |
28 | #define BOOST_PARAMETER_FUNCTION_DISPATCH_TAG_NAMESPACE(x) \
29 | BOOST_PP_TUPLE_ELEM(5, 4, x)
30 | /**/
31 |
32 | #endif // include guard
33 |
34 |
--------------------------------------------------------------------------------
/test/literate/default-expression-evaluation0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 |
5 | BOOST_PARAMETER_NAME(graph)
6 | BOOST_PARAMETER_NAME(visitor)
7 | BOOST_PARAMETER_NAME(root_vertex)
8 | BOOST_PARAMETER_NAME(index_map)
9 | BOOST_PARAMETER_NAME(color_map)
10 |
11 | BOOST_PARAMETER_FUNCTION((bool), depth_first_search, tag,
12 | (required
13 | (graph, *)
14 | (visitor, *)
15 | (root_vertex, *)
16 | (index_map, *)
17 | (color_map, *)
18 | )
19 | )
20 | {
21 | std::cout << "graph=" << graph;
22 | std::cout << std::endl;
23 | std::cout << "visitor=" << visitor;
24 | std::cout << std::endl;
25 | std::cout << "root_vertex=" << root_vertex;
26 | std::cout << std::endl;
27 | std::cout << "index_map=" << index_map;
28 | std::cout << std::endl;
29 | std::cout << "color_map=" << color_map;
30 | std::cout << std::endl;
31 | return true;
32 | }
33 |
34 | #include
35 |
36 | int main()
37 | {
38 | char const* g = "1";
39 | depth_first_search(1, 2, 3, 4, 5);
40 | depth_first_search(
41 | g, '2', _color_map = '5'
42 | , _index_map = "4", _root_vertex = "3"
43 | );
44 | return boost::report_errors();
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/preprocessor/impl/parenthesized_type.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams 2006.
2 | // Distributed under 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_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
7 | #define BOOST_PARAMETER_AUX_PREPROCESSOR_IMPL_PARENTHESIZED_TYPE_HPP
8 |
9 | namespace boost { namespace parameter { namespace aux {
10 |
11 | // A metafunction that transforms void(*)(T) -> T
12 | template
13 | struct unaryfunptr_arg_type;
14 |
15 | template
16 | struct unaryfunptr_arg_type
17 | {
18 | typedef Arg type;
19 | };
20 |
21 | template <>
22 | struct unaryfunptr_arg_type
23 | {
24 | typedef void type;
25 | };
26 | }}} // namespace boost::parameter::aux
27 |
28 | // A macro that takes a parenthesized C++ type name (T) and transforms it
29 | // into an un-parenthesized type expression equivalent to T.
30 | #define BOOST_PARAMETER_PARENTHESIZED_TYPE(x) \
31 | ::boost::parameter::aux::unaryfunptr_arg_type< void(*)x >::type
32 |
33 | #endif // include guard
34 |
35 |
--------------------------------------------------------------------------------
/test/literate/top-level0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | namespace test {
5 |
6 | BOOST_PARAMETER_NAME(title)
7 | BOOST_PARAMETER_NAME(width)
8 | BOOST_PARAMETER_NAME(titlebar)
9 |
10 | BOOST_PARAMETER_FUNCTION((int), new_window, tag,
11 | (required (title,*)(width,*)(titlebar,*))
12 | )
13 | {
14 | return 0;
15 | }
16 |
17 | BOOST_PARAMETER_TEMPLATE_KEYWORD(deleter)
18 | BOOST_PARAMETER_TEMPLATE_KEYWORD(copy_policy)
19 |
20 | template
21 | struct Deallocate
22 | {
23 | };
24 |
25 | struct DeepCopy
26 | {
27 | };
28 |
29 | struct Foo
30 | {
31 | };
32 |
33 | template
34 | struct smart_ptr
35 | {
36 | smart_ptr(test::Foo*)
37 | {
38 | }
39 | };
40 | }
41 |
42 | #include
43 |
44 | int main()
45 | {
46 | char const* alert_s = "alert";
47 | int x = test::new_window(alert_s, test::_width=10, test::_titlebar=false);
48 | test::Foo* foo = new test::Foo();
49 | test::smart_ptr<
50 | test::Foo
51 | , test::deleter >
52 | , test::copy_policy
53 | > p(foo);
54 | delete foo;
55 | return boost::report_errors();
56 | }
57 |
58 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/unmatched_argument.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_UNMATCHED_ARGUMENT_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_UNMATCHED_ARGUMENT_HPP
8 |
9 | #include
10 |
11 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
12 | #include
13 | #else
14 | #include
15 | #include
16 | #include
17 | #include
18 | #endif
19 |
20 | namespace boost { namespace parameter { namespace aux {
21 |
22 | template
23 | struct unmatched_argument
24 | {
25 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
26 | static_assert(::std::is_same::value, "T == void");
27 | #else
28 | BOOST_MPL_ASSERT((
29 | typename ::boost::mpl::if_<
30 | ::boost::is_same
31 | , ::boost::mpl::true_
32 | , ::boost::mpl::false_
33 | >::type
34 | ));
35 | #endif
36 | typedef int type;
37 | };
38 | }}} // namespace boost::parameter::aux
39 |
40 | #endif // include guard
41 |
42 |
--------------------------------------------------------------------------------
/test/tutorial.cpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams 2005.
2 | // Distributed under 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 | #include
7 |
8 | namespace graphs {
9 |
10 | BOOST_PARAMETER_NAME(graph) // Note: no semicolon
11 | BOOST_PARAMETER_NAME(visitor)
12 | BOOST_PARAMETER_NAME(root_vertex)
13 | BOOST_PARAMETER_NAME(index_map)
14 | BOOST_PARAMETER_NAME(color_map)
15 | } // namespace graphs
16 |
17 | #include
18 |
19 | namespace graphs { namespace core {
20 |
21 | template
22 | void depth_first_search(ArgumentPack const& args)
23 | {
24 | BOOST_TEST_EQ(false, args[_color_map]);
25 | BOOST_TEST_EQ('G', args[_graph]);
26 | BOOST_TEST_CSTR_EQ("hello, world", args[_index_map]);
27 | BOOST_TEST_EQ(3.5, args[_root_vertex]);
28 | BOOST_TEST_EQ(2, args[_visitor]);
29 | }
30 | }} // namespace graphs::core
31 |
32 | int main()
33 | {
34 | using namespace graphs;
35 |
36 | core::depth_first_search((
37 | _graph = 'G', _visitor = 2, _root_vertex = 3.5
38 | , _index_map = "hello, world", _color_map = false
39 | ));
40 | return boost::report_errors();
41 | }
42 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/always_true_predicate.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Cromwell D. Enage 2019.
2 | // Distributed under 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_AUX_ALWAYS_TRUE_PREDICATE_HPP
7 | #define BOOST_PARAMETER_AUX_ALWAYS_TRUE_PREDICATE_HPP
8 |
9 | #include
10 | #include
11 |
12 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
13 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
14 | #include
15 | #endif
16 | #else
17 | #include
18 | #endif
19 |
20 | namespace boost { namespace parameter { namespace aux {
21 |
22 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
23 | struct always_true_predicate
24 | {
25 | template
26 | struct apply
27 | {
28 | typedef ::boost::mpl::true_ type;
29 | };
30 |
31 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
32 | template
33 | using fn = ::boost::mp11::mp_true;
34 | #endif
35 | };
36 | #else
37 | typedef ::boost::mpl::always< ::boost::mpl::true_> always_true_predicate;
38 | #endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES
39 | }}} // namespace boost::parameter::aux
40 |
41 | #endif // include guard
42 |
43 |
--------------------------------------------------------------------------------
/test/literate/extracting-parameter-types0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | BOOST_PARAMETER_NAME(name)
5 | BOOST_PARAMETER_NAME(index)
6 |
7 | template
8 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
9 | void noop(T&&)
10 | #else
11 | void noop(T&)
12 | #endif
13 | {
14 | }
15 |
16 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
17 | #include
18 | #endif
19 |
20 | template
21 | #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
22 | int deduce_arg_types_impl(Name&& name, Index&& index)
23 | {
24 | noop(std::forward(name));
25 | noop(std::forward(index));
26 | return index;
27 | }
28 | #else
29 | int deduce_arg_types_impl(Name& name, Index& index)
30 | {
31 | Name& n2 = name; // we know the types
32 | Index& i2 = index;
33 | noop(n2);
34 | noop(i2);
35 | return index;
36 | }
37 | #endif
38 |
39 | template
40 | int deduce_arg_types(ArgumentPack const& args)
41 | {
42 | return deduce_arg_types_impl(args[_name], args[_index|42]);
43 | }
44 |
45 | #include
46 |
47 | int main()
48 | {
49 | int a1 = deduce_arg_types((_name = "foo"));
50 | int a2 = deduce_arg_types((_name = "foo", _index = 3));
51 | BOOST_TEST_EQ(a1, 42);
52 | BOOST_TEST_EQ(a2, 3);
53 | return boost::report_errors();
54 | }
55 |
56 |
--------------------------------------------------------------------------------
/test/literate/writing-the-function0.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | BOOST_PARAMETER_NAME(graph)
5 | BOOST_PARAMETER_NAME(visitor)
6 | BOOST_PARAMETER_NAME(root_vertex)
7 | BOOST_PARAMETER_NAME(index_map)
8 | BOOST_PARAMETER_NAME(in_out(color_map))
9 |
10 | namespace boost {
11 |
12 | template
13 | struct dfs_visitor
14 | {
15 | };
16 |
17 | int vertex_index = 0;
18 | }
19 |
20 | #include
21 |
22 | namespace graphs {
23 |
24 | BOOST_PARAMETER_FUNCTION(
25 | (void), // 1. parenthesized return type
26 | depth_first_search, // 2. name of the function template
27 |
28 | tag, // 3. namespace of tag types
29 |
30 | (required (graph, *) ) // 4. one required parameter, and
31 |
32 | (optional // four optional parameters, with defaults
33 | (visitor, *, boost::dfs_visitor<>())
34 | (root_vertex, *, *vertices(graph).first)
35 | (index_map, *, get(boost::vertex_index,graph))
36 | (in_out(color_map), *,
37 | default_color_map(num_vertices(graph), index_map)
38 | )
39 | )
40 | )
41 | {
42 | // ... body of function goes here...
43 | // use graph, visitor, index_map, and color_map
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/test/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Copyright 2019 Mike Dev
2 | # Distributed under the Boost Software License, Version 1.0.
3 | # See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
4 | #
5 | # NOTE: CMake support for Boost.Parameter is currently experimental at best
6 | # and the interface is likely to change in the future
7 |
8 | include_directories(${CMAKE_CURRENT_SOURCE_DIR})
9 |
10 | # TODO: Also process literate tests
11 | file(GLOB test_files *.cpp)
12 |
13 | # remove some test for which the dependencies are not yet available or have
14 | # special requirements
15 | # TODO: enable more tests
16 | list(FILTER test_files EXCLUDE REGEX
17 | efficiency|deduced_unmatched_arg|duplicates)
18 |
19 | # Attach all our tests to the `tests` target, to enable
20 | # `cmake --build . --target tests`
21 | if(NOT TARGET tests)
22 | add_custom_target(tests)
23 | endif()
24 |
25 | foreach(file IN LISTS test_files)
26 |
27 | get_filename_component(core_name ${file} NAME_WE)
28 | set(test_name boost_parameter-test-${core_name})
29 |
30 | add_executable(${test_name} EXCLUDE_FROM_ALL ${file})
31 | add_dependencies(tests ${test_name})
32 |
33 | # add Boost.Parameter and any libraries that are only needed by the tests
34 | # (none at the moment)
35 | target_link_libraries(${test_name} Boost::parameter)
36 |
37 | add_test(NAME ${test_name} COMMAND ${test_name})
38 |
39 | endforeach()
40 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/as_parameter_requirements.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_AS_PARAMETER_REQUIREMENTS_HPP
8 |
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | namespace boost { namespace parameter { namespace aux {
15 |
16 | // Converts a ParameterSpec into a specialization of
17 | // parameter_requirements. We need to do this in order to get the
18 | // tag_type into the type in a way that can be conveniently matched
19 | // by a satisfies(...) member function in arg_list.
20 | template
21 | struct as_parameter_requirements
22 | {
23 | typedef ::boost::parameter::aux::parameter_requirements<
24 | typename ::boost::parameter::aux::tag_type::type
25 | , typename ::boost::parameter::aux::predicate::type
26 | , ::boost::parameter::aux::has_default
27 | > type;
28 | };
29 | }}} // namespace boost::parameter::aux
30 |
31 | #endif // include guard
32 |
33 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/is_named_argument.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_IS_NAMED_ARGUMENT_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_IS_NAMED_ARGUMENT_HPP
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
14 | #include
15 | #include
16 | #else
17 | #include
18 | #include
19 | #endif
20 |
21 | namespace boost { namespace parameter { namespace aux {
22 |
23 | template
24 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
25 | using is_named_argument = ::boost::mp11::mp_if<
26 | ::boost::parameter::aux::is_template_keyword
27 | , ::boost::mp11::mp_true
28 | , ::boost::parameter::aux::is_tagged_argument_mp11
29 | >;
30 | #else
31 | struct is_named_argument
32 | : ::boost::mpl::if_<
33 | ::boost::parameter::aux::is_template_keyword
34 | , ::boost::mpl::true_
35 | , ::boost::parameter::aux::is_tagged_argument
36 | >::type
37 | {
38 | };
39 | #endif
40 | }}} // namespace boost::parameter::aux
41 |
42 | #endif // include guard
43 |
44 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/item.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_ITEM_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_ITEM_HPP
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
14 | #include
15 | #include
16 | #endif
17 |
18 | namespace boost { namespace parameter { namespace aux {
19 |
20 | // A parameter spec item typelist.
21 | template <
22 | typename Spec
23 | , typename Arg
24 | , typename Tail = ::boost::parameter::void_
25 | >
26 | struct item
27 | {
28 | typedef Spec spec;
29 | #if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x564))
30 | typedef ::boost::is_const<
31 | typename ::boost::remove_reference::type
32 | > is_arg_const;
33 | #endif
34 | typedef Arg arg;
35 | typedef Tail tail;
36 | };
37 |
38 | template
39 | struct make_item
40 | {
41 | typedef boost::parameter::aux
42 | ::item type;
43 | };
44 | }}} // namespace boost::parameter::aux
45 |
46 | #endif // include guard
47 |
48 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/pack/make_items.hpp:
--------------------------------------------------------------------------------
1 | // Copyright David Abrahams, Daniel Wallin 2003.
2 | // Distributed under 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_AUX_PACK_MAKE_ITEMS_HPP
7 | #define BOOST_PARAMETER_AUX_PACK_MAKE_ITEMS_HPP
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
14 | #include
15 | #include
16 | #else
17 | #include
18 | #include
19 | #include
20 | #endif
21 |
22 | namespace boost { namespace parameter { namespace aux {
23 |
24 | // Creates a item typelist.
25 | template
26 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
27 | using make_items = ::boost::mp11::mp_if<
28 | ::std::is_same
29 | , ::boost::mp11::mp_identity< ::boost::parameter::void_>
30 | , ::boost::parameter::aux::make_item
31 | >;
32 | #else
33 | struct make_items
34 | : ::boost::mpl::eval_if<
35 | ::boost::is_same
36 | , ::boost::mpl::identity< ::boost::parameter::void_>
37 | , ::boost::parameter::aux::make_item
38 | >
39 | {
40 | };
41 | #endif
42 | }}} // namespace boost::parameter::aux
43 |
44 | #endif // include guard
45 |
46 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/is_maybe.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin, David Abrahams 2010.
2 | // Distributed under 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_IS_MAYBE_050329_HPP
7 | #define BOOST_PARAMETER_IS_MAYBE_050329_HPP
8 |
9 | namespace boost { namespace parameter { namespace aux {
10 |
11 | struct maybe_base
12 | {
13 | };
14 | }}} // namespace boost::parameter::aux
15 |
16 | #if defined(BOOST_PARAMETER_CAN_USE_MP11)
17 | #include
18 |
19 | namespace boost { namespace parameter { namespace aux {
20 |
21 | template
22 | using is_maybe = ::std::is_base_of<
23 | ::boost::parameter::aux::maybe_base
24 | , typename ::std::remove_const::type
25 | >;
26 | }}} // namespace boost::parameter::aux
27 |
28 | #else // !defined(BOOST_PARAMETER_CAN_USE_MP11)
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 | namespace boost { namespace parameter { namespace aux {
35 |
36 | template
37 | struct is_maybe
38 | : ::boost::mpl::if_<
39 | ::boost::is_base_of<
40 | ::boost::parameter::aux::maybe_base
41 | , typename ::boost::remove_const::type
42 | >
43 | , ::boost::mpl::true_
44 | , ::boost::mpl::false_
45 | >::type
46 | {
47 | };
48 | }}} // namespace boost::parameter::aux
49 |
50 | #endif // BOOST_PARAMETER_CAN_USE_MP11
51 | #endif // include guard
52 |
53 |
--------------------------------------------------------------------------------
/include/boost/parameter/aux_/yesno.hpp:
--------------------------------------------------------------------------------
1 | // Copyright Daniel Wallin, David Abrahams 2005.
2 | // Distributed under 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_AUX_YESNO_HPP
7 | #define BOOST_PARAMETER_AUX_YESNO_HPP
8 |
9 | namespace boost { namespace parameter { namespace aux {
10 |
11 | // types used with the "sizeof trick" to capture the results of
12 | // overload resolution at compile-time.
13 | typedef char yes_tag;
14 | typedef char (&no_tag)[2];
15 | }}} // namespace boost::parameter::aux
16 |
17 | #include