mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-24 06:02:12 +00:00
Compare commits
1 Commits
boost-1.33
...
boost-1.33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94a1deae4c |
@@ -675,7 +675,7 @@ been the first parameter, we would have needed <em>ten</em> overloads. In
|
||||
the worst case—where the function has five “out” parameters—2<sup>5</sup> or 32 overloads would be required. This “<a class="reference" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2002/n1385.htm">forwarding
|
||||
problem</a>” is well-known to generic library authors, and the C++
|
||||
standard committee is working on a <a class="reference" href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1690.html">proposal</a> to address it. In
|
||||
the meantime, you might consider using <a class="reference" href="../../../preprocessor/index.html">Boost.Preprocessor</a> to
|
||||
the meantime, you might consider using <a class="reference" href="../../../preprocessor">Boost.Preprocessor</a> to
|
||||
generate the overloads you need.</p>
|
||||
<p>If it is impractical for you to generate or write the overloads
|
||||
that would be required for positional “out” arguments to be passed
|
||||
@@ -926,7 +926,7 @@ typename parameter::binding<
|
||||
];
|
||||
</pre>
|
||||
<div class="sidebar">
|
||||
<p class="first sidebar-title">Mnemonics</p>
|
||||
<p class="first sidebar-title">Mnemnonics</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-13 01:16 UTC.
|
||||
Generated on: 2005-08-05 14:51 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>
|
||||
|
||||
@@ -698,7 +698,7 @@ generate the overloads you need.
|
||||
|
||||
__ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1690.html
|
||||
|
||||
.. _`Boost.Preprocessor`: ../../../preprocessor/index.html
|
||||
.. _`Boost.Preprocessor`: ../../../preprocessor
|
||||
|
||||
If it is impractical for you to generate or write the overloads
|
||||
that would be required for positional “out” arguments to be passed
|
||||
@@ -994,7 +994,7 @@ Boost.Lambda_: [#bind]_
|
||||
**|| boost::lambda::construct<default_color_map>(num_vertices(g),i)**
|
||||
];
|
||||
|
||||
.. sidebar:: Mnemonics
|
||||
.. sidebar:: Mnemnonics
|
||||
|
||||
To remember the difference between ``|`` and ``||``, recall that
|
||||
``||`` normally uses short-circuit evaluation: its second
|
||||
|
||||
@@ -6,20 +6,18 @@
|
||||
#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.
|
||||
@@ -136,7 +134,6 @@ 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;
|
||||
@@ -243,38 +240,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&) const
|
||||
reference get(keyword<key_type> const& x) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference get(default_<key_type,Default>) const
|
||||
reference get(default_<key_type,Default> x) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference get(lazy_default<key_type, Default>) const
|
||||
reference get(lazy_default<key_type, Default> x) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
reference operator[](keyword<key_type> const&) const
|
||||
reference operator[](keyword<key_type> const& x) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference operator[](default_<key_type, Default>) const
|
||||
reference operator[](default_<key_type, Default> x) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
reference operator[](lazy_default<key_type, Default>) const
|
||||
reference operator[](lazy_default<key_type, Default> x) const
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
@@ -306,14 +303,16 @@ 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>, self>
|
||||
operator,(tagged_argument<KW,T2> x)
|
||||
arg_list<tagged_argument<KW, T2>, arg_list>
|
||||
operator,(tagged_argument<KW, T2> x) const
|
||||
{
|
||||
return arg_list<tagged_argument<KW,T2>, self>(x, *this);
|
||||
return arg_list<tagged_argument<KW, T2>, arg_list>(x, *this);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // ETI workaround
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
# 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,7 +8,6 @@
|
||||
|
||||
#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 {
|
||||
|
||||
@@ -47,7 +46,7 @@ struct tagged_argument
|
||||
|
||||
// Defines a metafunction, is_tagged_argument, that identifies
|
||||
// tagged_argument specializations.
|
||||
BOOST_DETAIL_IS_XXX_DEF(tagged_argument,tagged_argument,2)
|
||||
BOOST_PYTHON_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, < 1300) // avoid partial ordering bugs
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200) // 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, < 1300) // avoid partial ordering bugs
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // avoid partial ordering bugs
|
||||
template <class Default>
|
||||
aux::default_<Tag, const Default>
|
||||
operator|(const Default& default_) const
|
||||
@@ -105,28 +105,13 @@ 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
|
||||
// reference in an anonymous namespace to a singleton instance of that
|
||||
// type.
|
||||
// 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();
|
||||
|
||||
#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
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#ifndef BOOST_PARAMETERS_031014_HPP
|
||||
#define BOOST_PARAMETERS_031014_HPP
|
||||
|
||||
#include <boost/detail/is_xxx.hpp>
|
||||
|
||||
#include <boost/mpl/lambda.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/always.hpp>
|
||||
@@ -20,6 +18,8 @@
|
||||
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/iterator/detail/config_def.hpp>
|
||||
#include <boost/python/detail/is_xxx.hpp>
|
||||
|
||||
#include <boost/preprocessor/repetition/enum.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <boost/parameter/aux_/tag.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
||||
template<class T> class reference_wrapper;
|
||||
@@ -90,8 +89,8 @@ namespace aux
|
||||
{
|
||||
// Defines metafunctions, is_required and is_optional, that
|
||||
// identify required<...> and optional<...> specializations.
|
||||
BOOST_DETAIL_IS_XXX_DEF(required, required, 2)
|
||||
BOOST_DETAIL_IS_XXX_DEF(optional, optional, 2)
|
||||
BOOST_PYTHON_IS_XXX_DEF(required, required, 2)
|
||||
BOOST_PYTHON_IS_XXX_DEF(optional, optional, 2)
|
||||
|
||||
//
|
||||
// key_type, has_default, and predicate --
|
||||
@@ -451,5 +450,7 @@ struct parameters
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/iterator/detail/config_undef.hpp>
|
||||
|
||||
#endif // BOOST_PARAMETERS_031014_HPP
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ test-suite "parameter"
|
||||
: [ run basics.cpp ]
|
||||
[ run sfinae.cpp ]
|
||||
[ run macros.cpp ]
|
||||
[ run tutorial.cpp ]
|
||||
[ compile unwrap_cv_reference.cpp ]
|
||||
;
|
||||
|
||||
|
||||
@@ -4,6 +4,5 @@ test-suite "parameter"
|
||||
: [ run basics.cpp ]
|
||||
[ run sfinae.cpp ]
|
||||
[ run macros.cpp ]
|
||||
[ run tutorial.cpp ]
|
||||
[ compile unwrap_cv_reference.cpp ]
|
||||
;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// 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