mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-19 04:22:13 +00:00
This commit was manufactured by cvs2svn to create tag
'merged_to_RC_1_33_0'. [SVN r31853]
This commit is contained in:
@@ -926,7 +926,7 @@ typename parameter::binding<
|
||||
];
|
||||
</pre>
|
||||
<div class="sidebar">
|
||||
<p class="first sidebar-title">Mnemnonics</p>
|
||||
<p class="first sidebar-title">Mnemonics</p>
|
||||
<p class="last">To remember the difference between <tt class="docutils literal"><span class="pre">|</span></tt> and <tt class="docutils literal"><span class="pre">||</span></tt>, recall that
|
||||
<tt class="docutils literal"><span class="pre">||</span></tt> normally uses short-circuit evaluation: its second
|
||||
argument is only evaluated if its first argument is <tt class="docutils literal"><span class="pre">false</span></tt>.
|
||||
@@ -1191,7 +1191,7 @@ information on SFINAE.</td></tr>
|
||||
</div>
|
||||
<hr class="docutils footer" />
|
||||
<div class="footer">
|
||||
Generated on: 2005-08-05 14:51 UTC.
|
||||
Generated on: 2005-08-13 01:16 UTC.
|
||||
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -994,7 +994,7 @@ Boost.Lambda_: [#bind]_
|
||||
**|| boost::lambda::construct<default_color_map>(num_vertices(g),i)**
|
||||
];
|
||||
|
||||
.. sidebar:: Mnemnonics
|
||||
.. sidebar:: Mnemonics
|
||||
|
||||
To remember the difference between ``|`` and ``||``, recall that
|
||||
``||`` normally uses short-circuit evaluation: its second
|
||||
|
||||
@@ -6,18 +6,20 @@
|
||||
#ifndef ARG_LIST_050329_HPP
|
||||
#define ARG_LIST_050329_HPP
|
||||
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/result_of0.hpp>
|
||||
#include <boost/parameter/aux_/default.hpp>
|
||||
#include <boost/parameter/aux_/parameter_requirements.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#include <boost/mpl/apply.hpp>
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// Forward declaration for aux::arg_list, below.
|
||||
@@ -134,6 +136,7 @@ struct tagged_argument;
|
||||
template <class TaggedArg, class Next = empty_arg_list>
|
||||
struct arg_list : Next
|
||||
{
|
||||
typedef arg_list<TaggedArg,Next> 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<key_type> const& x) const
|
||||
reference get(keyword<key_type> const&) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference get(default_<key_type,Default> x) const
|
||||
reference get(default_<key_type,Default>) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference get(lazy_default<key_type, Default> x) const
|
||||
reference get(lazy_default<key_type, Default>) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
reference operator[](keyword<key_type> const& x) const
|
||||
reference operator[](keyword<key_type> const&) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference operator[](default_<key_type, Default> x) const
|
||||
reference operator[](default_<key_type, Default>) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference operator[](lazy_default<key_type, Default> x) const
|
||||
reference operator[](lazy_default<key_type, 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 <class KW, class T2>
|
||||
arg_list<tagged_argument<KW, T2>, arg_list>
|
||||
operator,(tagged_argument<KW, T2> x) const
|
||||
arg_list<tagged_argument<KW, T2>, self>
|
||||
operator,(tagged_argument<KW,T2> x)
|
||||
{
|
||||
return arg_list<tagged_argument<KW, T2>, arg_list>(x, *this);
|
||||
return arg_list<tagged_argument<KW,T2>, self>(x, *this);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // ETI workaround
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
# define BOOST_PARAMETER_AUX_TAG_DWA2005610_HPP
|
||||
|
||||
# include <boost/parameter/aux_/unwrap_cv_reference.hpp>
|
||||
# include <boost/parameter/aux_/tagged_argument.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <class Keyword, class Arg>
|
||||
struct tagged_argument;
|
||||
|
||||
template <class Keyword, class ActualArg
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
, class = typename is_cv_reference_wrapper<ActualArg>::type
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <boost/parameter/aux_/void.hpp>
|
||||
#include <boost/parameter/aux_/arg_list.hpp>
|
||||
#include <boost/detail/is_xxx.hpp>
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ struct keyword : noncopyable
|
||||
return aux::lazy_default<Tag, Default>(default_);
|
||||
}
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) // avoid partial ordering bugs
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) // avoid partial ordering bugs
|
||||
template <class T>
|
||||
typename aux::tag<Tag, T const>::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 <class Default>
|
||||
aux::default_<Tag, const 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<tag_namespace::name>& name \
|
||||
= ::boost::parameter::keyword<tag_namespace::name>::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<tag_namespace::name>& name \
|
||||
= ::boost::parameter::keyword<tag_namespace::name>::get();
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PARAMETER_KEYWORD(tag_namespace,name) \
|
||||
namespace tag_namespace { struct name; } \
|
||||
namespace \
|
||||
{ \
|
||||
::boost::parameter::keyword<tag_namespace::name>& name \
|
||||
= ::boost::parameter::keyword<tag_namespace::name>::get(); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}} // namespace boost::parameter
|
||||
|
||||
|
||||
@@ -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 ]
|
||||
;
|
||||
|
||||
|
||||
@@ -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 : : : <variant>release ]
|
||||
[ compile unwrap_cv_reference.cpp ]
|
||||
;
|
||||
|
||||
38
test/tutorial.cpp
Executable file
38
test/tutorial.cpp
Executable file
@@ -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 <iostream>
|
||||
#include <boost/parameter/keyword.hpp>
|
||||
|
||||
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 <class ArgumentPack>
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user