diff --git a/doc/html/index.html b/doc/html/index.html index 64cb614..f061c4c 100755 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -926,7 +926,7 @@ typename parameter::binding< ]; diff --git a/doc/index.rst b/doc/index.rst index c49aef9..871da0e 100755 --- a/doc/index.rst +++ b/doc/index.rst @@ -994,7 +994,7 @@ Boost.Lambda_: [#bind]_ **|| boost::lambda::construct(num_vertices(g),i)** ]; -.. sidebar:: Mnemnonics +.. sidebar:: Mnemonics To remember the difference between ``|`` and ``||``, recall that ``||`` normally uses short-circuit evaluation: its second diff --git a/include/boost/parameter/aux_/arg_list.hpp b/include/boost/parameter/aux_/arg_list.hpp index f0eca00..2def8e9 100755 --- a/include/boost/parameter/aux_/arg_list.hpp +++ b/include/boost/parameter/aux_/arg_list.hpp @@ -6,18 +6,20 @@ #ifndef ARG_LIST_050329_HPP #define ARG_LIST_050329_HPP -#include -#include - -#include -#include - #include #include #include #include #include +#include + +#include +#include + +#include +#include + namespace boost { namespace parameter { // Forward declaration for aux::arg_list, below. @@ -134,6 +136,7 @@ struct tagged_argument; template struct arg_list : Next { + typedef arg_list self; typedef typename TaggedArg::key_type key_type; typedef typename TaggedArg::value_type value_type; typedef typename TaggedArg::reference reference; @@ -240,38 +243,38 @@ struct arg_list : Next // reached, indicating no matching argument was passed, the // default is returned, or if no default_ or lazy_default was // passed, compilation fails. - reference get(keyword const& x) const + reference get(keyword const&) const { return arg.value; } template - reference get(default_ x) const + reference get(default_) const { return arg.value; } template - reference get(lazy_default x) const + reference get(lazy_default) const { return arg.value; } #else - reference operator[](keyword const& x) const + reference operator[](keyword const&) const { return arg.value; } template - reference operator[](default_ x) const + reference operator[](default_) const { return arg.value; } template - reference operator[](lazy_default x) const + reference operator[](lazy_default) const { return arg.value; } @@ -303,16 +306,14 @@ struct arg_list : Next using Next::satisfies; #endif -#if !BOOST_WORKAROUND(__BORLANDC__,BOOST_TESTED_AT(0x564)) // Comma operator to compose argument list without using parameters<>. // Useful for argument lists with undetermined length. template - arg_list, arg_list> - operator,(tagged_argument x) const + arg_list, self> + operator,(tagged_argument x) { - return arg_list, arg_list>(x, *this); + return arg_list, self>(x, *this); } -#endif }; #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // ETI workaround diff --git a/include/boost/parameter/aux_/tag.hpp b/include/boost/parameter/aux_/tag.hpp index a542c61..475efb9 100755 --- a/include/boost/parameter/aux_/tag.hpp +++ b/include/boost/parameter/aux_/tag.hpp @@ -5,12 +5,10 @@ # define BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP # include +# include namespace boost { namespace parameter { namespace aux { -template -struct tagged_argument; - template ::type diff --git a/include/boost/parameter/aux_/tagged_argument.hpp b/include/boost/parameter/aux_/tagged_argument.hpp index 723ceea..ed679d7 100755 --- a/include/boost/parameter/aux_/tagged_argument.hpp +++ b/include/boost/parameter/aux_/tagged_argument.hpp @@ -8,6 +8,7 @@ #include #include +#include namespace boost { namespace parameter { namespace aux { @@ -46,7 +47,7 @@ struct tagged_argument // Defines a metafunction, is_tagged_argument, that identifies // tagged_argument specializations. -BOOST_PYTHON_IS_XXX_DEF(tagged_argument,tagged_argument,2) +BOOST_DETAIL_IS_XXX_DEF(tagged_argument,tagged_argument,2) }}} // namespace boost::parameter::aux diff --git a/include/boost/parameter/keyword.hpp b/include/boost/parameter/keyword.hpp index 1320235..6b69b78 100755 --- a/include/boost/parameter/keyword.hpp +++ b/include/boost/parameter/keyword.hpp @@ -53,7 +53,7 @@ struct keyword : noncopyable return aux::lazy_default(default_); } -#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) // avoid partial ordering bugs +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) // avoid partial ordering bugs template typename aux::tag::type operator=(T const& x) const @@ -63,7 +63,7 @@ struct keyword : noncopyable } #endif -#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // avoid partial ordering bugs +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) // avoid partial ordering bugs template aux::default_ operator|(const Default& default_) const @@ -105,13 +105,28 @@ struct keyword : noncopyable // Reduces boilerplate required to declare and initialize keywords // without violating ODR. Declares a keyword tag type with the given -// name in namespace tag_namespace, and declares and initializes a -// -#define BOOST_PARAMETER_KEYWORD(tag_namespace,name) \ - namespace tag_namespace { struct name; } \ - ::boost::parameter::keyword& name \ - = ::boost::parameter::keyword::get(); +// name in namespace tag_namespace, and declares and initializes a +// reference in an anonymous namespace to a singleton instance of that +// type. +#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) + +# define BOOST_PARAMETER_KEYWORD(tag_namespace,name) \ + namespace tag_namespace { struct name; } \ + static ::boost::parameter::keyword& name \ + = ::boost::parameter::keyword::get(); + +#else + +#define BOOST_PARAMETER_KEYWORD(tag_namespace,name) \ + namespace tag_namespace { struct name; } \ + namespace \ + { \ + ::boost::parameter::keyword& name \ + = ::boost::parameter::keyword::get(); \ + } + +#endif }} // namespace boost::parameter diff --git a/test/Jamfile b/test/Jamfile index 4d235c7..62a8169 100755 --- a/test/Jamfile +++ b/test/Jamfile @@ -9,6 +9,8 @@ test-suite "parameter" : [ run basics.cpp ] [ run sfinae.cpp ] [ run macros.cpp ] + [ run unnamed.cpp ] + [ run tutorial.cpp ] + [ run efficiency.cpp : : : : : release ] [ compile unwrap_cv_reference.cpp ] ; - diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index fcb27ec..c6f6198 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -4,5 +4,8 @@ test-suite "parameter" : [ run basics.cpp ] [ run sfinae.cpp ] [ run macros.cpp ] + [ run unnamed.cpp ] + [ run tutorial.cpp ] + [ run efficiency.cpp : : : release ] [ compile unwrap_cv_reference.cpp ] ; diff --git a/test/tutorial.cpp b/test/tutorial.cpp new file mode 100755 index 0000000..7d96f97 --- /dev/null +++ b/test/tutorial.cpp @@ -0,0 +1,38 @@ +// Copyright David Abrahams 2005. Distributed under the Boost +// Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include + +namespace graphs +{ + BOOST_PARAMETER_KEYWORD(tag, graph) // Note: no semicolon + BOOST_PARAMETER_KEYWORD(tag, visitor) + BOOST_PARAMETER_KEYWORD(tag, root_vertex) + BOOST_PARAMETER_KEYWORD(tag, index_map) + BOOST_PARAMETER_KEYWORD(tag, color_map) +} + +namespace graphs { namespace core +{ + template + void depth_first_search(ArgumentPack const& args) + { + std::cout << "graph:\t" << args[graph] << std::endl; + std::cout << "visitor:\t" << args[visitor] << std::endl; + std::cout << "root_vertex:\t" << args[root_vertex] << std::endl; + std::cout << "index_map:\t" << args[index_map] << std::endl; + std::cout << "color_map:\t" << args[color_map] << std::endl; + } +}} // graphs::core + +int main() +{ + using namespace graphs; + + core::depth_first_search(( + graph = 'G', visitor = 2, root_vertex = 3.5, + index_map = "hello, world", color_map = false)); + return 0; +}