Compare commits

...

13 Commits

Author SHA1 Message Date
nobody
4e794207e3 This commit was manufactured by cvs2svn to create tag
'Version_1_33_1'.

[SVN r31916]
2005-12-05 14:04:06 +00:00
Douglas Gregor
51ef5da4e7 Clean up a whole lot of bad links
[SVN r31851]
2005-12-01 04:52:04 +00:00
Dave Abrahams
a56c147624 manually fix since my tobranch script didn't work.
[SVN r31502]
2005-10-29 17:46:07 +00:00
Dave Abrahams
61dd91fc37 merged from trunk
[SVN r31452]
2005-10-24 17:41:48 +00:00
nobody
9877a6f1be This commit was manufactured by cvs2svn to create branch 'RC_1_33_0'.
[SVN r31393]
2005-10-19 18:17:14 +00:00
Dave Abrahams
ee39cba737 merged from trunk
[SVN r31294]
2005-10-11 22:03:32 +00:00
Dave Abrahams
3c23aed910 Fixes for the RC branch
[SVN r31292]
2005-10-11 21:52:38 +00:00
Dave Abrahams
1b17eb5f7b merged from trunk
[SVN r31291]
2005-10-11 21:24:00 +00:00
Dave Abrahams
2b2c27930a merged from trunk
[SVN r31285]
2005-10-11 14:41:42 +00:00
Dave Abrahams
cd560b82f9 merged from trunk
[SVN r30567]
2005-08-13 01:19:53 +00:00
Dave Abrahams
43f2424a56 merged from trunk
[SVN r30489]
2005-08-05 15:02:14 +00:00
Dave Abrahams
fd29ba2c00 merged from trunk
[SVN r30451]
2005-08-04 05:09:00 +00:00
nobody
0bea8c0b9b This commit was manufactured by cvs2svn to create branch 'RC_1_33_0'.
[SVN r30300]
2005-07-28 18:22:24 +00:00
13 changed files with 171 additions and 77 deletions

View File

@@ -620,8 +620,11 @@ namespace graphs
void depth_first_search(A0 const& a0, A1 const& a1)
{
core::depth_first_search(dfs_params()(a0,a1));
}
<span class="doublesize"></span>
} <span class="vellipsis">
.
.
.
</span>
template &lt;class A0, class A1, …class A4&gt;
void depth_first_search(A0 const&amp; a0, A1 const&amp; a1, …A4 const&amp; a4)
{
@@ -672,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">Boost.Preprocessor</a> to
the meantime, you might consider using <a class="reference" href="../../../preprocessor/index.html">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
@@ -788,8 +791,11 @@ namespace graphs
, typename dfs_params::match&lt;A0,A1&gt;::type p = dfs_params())
{
core::depth_first_search(<strong>p</strong>(a0,a1));
}
<span class="doublesize"></span>
} <span class="vellipsis">
.
.
.
</span>
template &lt;class A0, class A1, …class A4&gt;
void depth_first_search(
A0 const&amp; a0, A1 const&amp; a1, …A4 const&amp; A4
@@ -833,8 +839,11 @@ namespace graphs
, <strong>BOOST_PARAMETER_MATCH(dfs_params, (A0)(A1), p)</strong>)
{
core::depth_first_search(p(a0,a1));
}
<span class="doublesize"></span>
} <span class="vellipsis">
.
.
.
</span>
template &lt;class A0, class A1, …class A4&gt;
void depth_first_search(
A0 const&amp; a0, A1 const&amp; a1, …A4 const&amp; A4
@@ -917,7 +926,7 @@ typename parameter::binding&lt;
];
</pre>
<div class="sidebar">
<p class="first sidebar-title">Memnonics</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>.
@@ -1136,12 +1145,12 @@ define</p>
typedef T result_type;
template &lt;class A1, class A2&gt;
T operator() { return T(a1,a2); }
T operator()(A1 a1, A2 a2) { return T(a1,a2); }
};
and use Boost.Bind_ to generate the function object::
and use `Boost.Bind`_ to generate the function object::
boost::bind(construct2&lt;default_color_map&gt;,num_vertices(g),i)
boost::bind(construct2&lt;default_color_map&gt;(),num_vertices(g),i)
</pre>
</td></tr>
</tbody>
@@ -1182,7 +1191,7 @@ information on SFINAE.</td></tr>
</div>
<hr class="docutils footer" />
<div class="footer">
Generated on: 2005-07-28 16:32 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>

View File

@@ -410,8 +410,11 @@ struct parameters
<a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const&amp; a0) const;
template &lt;class A0, class A1&gt;
<a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const&amp; a0, A1 const&amp; a1) const;
<span class="doublesize"></span>
<a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const&amp; a0, A1 const&amp; a1) const; <span class="vellipsis">
.
.
.
</span>
template &lt;class A0, class A1, …class Aβ&gt;
<a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const&amp; a0, A1 const&amp; a1, …Aβ const&amp; aβ) const;
};
@@ -480,8 +483,11 @@ every <em>j</em> in 0…β, either:</p>
<span class="target" id="id12"></span><dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">operator()</span></tt></dt>
<dd><pre class="first literal-block">
template &lt;class A0&gt; <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(A0 const&amp; a0) const;
<span class="doublesize"></span>
template &lt;class A0&gt; <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> operator()(A0 const&amp; a0) const; <span class="vellipsis">
.
.
.
</span>
template &lt;class A0, …class Aβ&gt; <a class="reference" href="#argumentpack"><span class="concept">ArgumentPack</span></a> <a class="reference" href="#id12">operator()</a>(A0 const&amp; a0, …Aβ const&amp; aβ) const;
</pre>
<table class="last docutils field-list" frame="void" rules="none">
@@ -644,8 +650,11 @@ r name(
, typename <strong>p</strong>::match&lt;A1,A2,…A<strong>l</strong>,A##<a class="reference" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)&gt;::type p = <strong>p</strong>())
{
return <strong>name</strong>_with_named_params(<strong>p</strong>(x1,x2,…x<strong>l</strong>,x##<a class="reference" href="../../../preprocessor/doc/ref/inc.html">BOOST_PP_INC</a>(<strong>l</strong>)));
}
<span class="doublesize"></span>
} <span class="vellipsis">
.
.
.
</span>
template &lt;class A1, class A2, …class A<strong>h</strong>&gt;
r name(
A1 const&amp; a1, A2 const&amp; a2, …A<strong>h</strong> const&amp; x<strong>h</strong>
@@ -769,7 +778,7 @@ where it could make a difference.</td></tr>
</div>
<hr class="docutils footer" />
<div class="footer">
Generated on: 2005-07-28 16:33 UTC.
Generated on: 2005-08-05 14:58 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>

View File

@@ -13,6 +13,12 @@ img {
vertical-align: middle
}
span.vellipsis {
line-height: 30% ;
font-size: 200% ;
}
PRE
{
FONT-FAMILY: monospace ;

View File

@@ -45,8 +45,8 @@ __ ../../../../index.htm
.. role:: concept
:class: concept
.. role:: large
:class: doublesize
.. role:: vellipsis
:class: vellipsis
.. section-numbering::
@@ -629,8 +629,11 @@ to its ``operator()`` and forwarding the result on to
void depth_first_search(A0 const& a0, A1 const& a1)
{
core::depth_first_search(dfs_params()(a0,a1));
}
:large:`⋮`
} :vellipsis:`\
.
.
.
`
template <class A0, class A1, …class A4>
void depth_first_search(A0 const& a0, A1 const& a1, …A4 const& a4)
{
@@ -695,7 +698,7 @@ generate the overloads you need.
__ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1690.html
.. _`Boost.Preprocessor`: ../../../preprocessor
.. _`Boost.Preprocessor`: ../../../preprocessor/index.html
If it is impractical for you to generate or write the overloads
that would be required for positional “out” arguments to be passed
@@ -831,8 +834,11 @@ Now we add a special defaulted argument to each of our
, typename dfs_params::match<A0,A1>::type p = dfs_params())
{
core::depth_first_search(**p**\ (a0,a1));
}
:large:`⋮`
} :vellipsis:`\
.
.
.
`
template <class A0, class A1, …class A4>
void depth_first_search(
A0 const& a0, A1 const& a1, …A4 const& A4
@@ -886,8 +892,11 @@ __ http://boost-consulting.com/mplbook/preprocessor.html#sequences
, **BOOST_PARAMETER_MATCH(dfs_params, (A0)(A1), p)**)
{
core::depth_first_search(p(a0,a1));
}
:large:`⋮`
} :vellipsis:`\
.
.
.
`
template <class A0, class A1, …class A4>
void depth_first_search(
A0 const& a0, A1 const& a1, …A4 const& A4
@@ -985,7 +994,7 @@ Boost.Lambda_: [#bind]_
**|| boost::lambda::construct<default_color_map>(num_vertices(g),i)**
];
.. sidebar:: Memnonics
.. sidebar:: Mnemonics
To remember the difference between ``|`` and ``||``, recall that
``||`` normally uses short-circuit evaluation: its second
@@ -1226,12 +1235,12 @@ __ ../../../graph/doc/bgl_named_params.html
typedef T result_type;
template <class A1, class A2>
T operator() { return T(a1,a2); }
T operator()(A1 a1, A2 a2) { return T(a1,a2); }
};
and use Boost.Bind_ to generate the function object::
and use `Boost.Bind`_ to generate the function object::
boost::bind(construct2<default_color_map>,num_vertices(g),i)
boost::bind(construct2<default_color_map>(),num_vertices(g),i)
__ http://www.boost.org/regression/release/user/lambda.html
.. _Boost.Bind: ../../../libs/bind/index.html

View File

@@ -41,9 +41,8 @@ __ ../../../../index.htm
.. |ArgumentPack| replace:: :concept:`ArgumentPack`
.. |ParameterSpec| replace:: :concept:`ParameterSpec`
.. role:: large
:class: doublesize
.. role:: vellipsis
:class: vellipsis
.. section-numbering::
:depth: 2
@@ -380,8 +379,11 @@ __ ../../../../boost/parameter/parameters.hpp
|ArgumentPack|_ `operator()`_\(A0 const& a0) const;
template <class A0, class A1>
|ArgumentPack|_ `operator()`_\(A0 const& a0, A1 const& a1) const;
:large:`⋮`
|ArgumentPack|_ `operator()`_\(A0 const& a0, A1 const& a1) const; :vellipsis:`\
.
.
.
`
template <class A0, class A1, …class A\ β>
|ArgumentPack|_ `operator()`_\(A0 const& a0, A1 const& a1, …A\ β const& a\ β) const;
};
@@ -436,8 +438,11 @@ __ ../../../../boost/parameter/parameters.hpp
``operator()``
.. parsed-literal::
template <class A0> |ArgumentPack|_ operator()(A0 const& a0) const;
:large:`⋮`
template <class A0> |ArgumentPack|_ operator()(A0 const& a0) const; :vellipsis:`\
.
.
.
`
template <class A0, …class A\ β> |ArgumentPack|_ `operator()`_\(A0 const& a0, …A\ β const& a\ β) const;
:Returns:
@@ -577,8 +582,11 @@ Generates
, typename **p**::match<A1,A2,…A\ **l**,A\ ##\ BOOST_PP_INC_\ (**l**)>::type p = **p**\ ())
{
return **name**\ _with_named_params(**p**\ (x1,x2,…x\ **l**,x\ ##\ BOOST_PP_INC_\ (**l**)));
}
:large:`⋮`
} :vellipsis:`\
.
.
.
`
template <class A1, class A2, …class A\ **h**>
r name(
A1 const& a1, A2 const& a2, …A\ **h** const& x\ **h**

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -6,6 +6,8 @@
#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>
@@ -18,8 +20,6 @@
#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,6 +42,7 @@
#include <boost/parameter/aux_/tag.hpp>
#include <boost/parameter/config.hpp>
namespace boost {
template<class T> class reference_wrapper;
@@ -89,8 +90,8 @@ namespace aux
{
// Defines metafunctions, is_required and is_optional, that
// identify required<...> and optional<...> specializations.
BOOST_PYTHON_IS_XXX_DEF(required, required, 2)
BOOST_PYTHON_IS_XXX_DEF(optional, optional, 2)
BOOST_DETAIL_IS_XXX_DEF(required, required, 2)
BOOST_DETAIL_IS_XXX_DEF(optional, optional, 2)
//
// key_type, has_default, and predicate --
@@ -450,7 +451,5 @@ struct parameters
} // namespace boost
#include <boost/iterator/detail/config_undef.hpp>
#endif // BOOST_PARAMETERS_031014_HPP

View File

@@ -9,6 +9,6 @@ test-suite "parameter"
: [ run basics.cpp ]
[ run sfinae.cpp ]
[ run macros.cpp ]
[ run tutorial.cpp ]
[ compile unwrap_cv_reference.cpp ]
;

View File

@@ -4,5 +4,6 @@ test-suite "parameter"
: [ run basics.cpp ]
[ run sfinae.cpp ]
[ run macros.cpp ]
[ run tutorial.cpp ]
[ compile unwrap_cv_reference.cpp ]
;

38
test/tutorial.cpp Executable file
View 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;
}