mirror of
https://github.com/boostorg/parameter.git
synced 2026-01-22 05:22:31 +00:00
Compare commits
125 Commits
boost-1.44
...
svn-branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b53143bc35 | ||
|
|
e054a75533 | ||
|
|
834f245953 | ||
|
|
ef9dfeb2d1 | ||
|
|
98bcbbad78 | ||
|
|
d9f0e42397 | ||
|
|
0a26a05500 | ||
|
|
2e725894c6 | ||
|
|
a4b2742095 | ||
|
|
2af6d0439e | ||
|
|
276d786ed9 | ||
|
|
7689b5b9d0 | ||
|
|
a28883d9ad | ||
|
|
45bac7b579 | ||
|
|
e4e6ba52c4 | ||
|
|
6bb4b0ef8b | ||
|
|
e0416b8343 | ||
|
|
f8a1b652bc | ||
|
|
f7611b8a1f | ||
|
|
493a8b28a5 | ||
|
|
32ec272b6d | ||
|
|
4c8c0cce93 | ||
|
|
8fc7ba81cc | ||
|
|
5b2b1a47f8 | ||
|
|
f3764c539e | ||
|
|
b67fbdff8f | ||
|
|
0e263f5602 | ||
|
|
3c815b31fe | ||
|
|
dbbe37b8c1 | ||
|
|
ce712b8f30 | ||
|
|
913fa2eb44 | ||
|
|
12c873d3e4 | ||
|
|
164c48c018 | ||
|
|
2ac8833532 | ||
|
|
6556e278c6 | ||
|
|
1a9e89cb8d | ||
|
|
6d53a2b914 | ||
|
|
c7296b9a05 | ||
|
|
6a5d61ce3c | ||
|
|
e887f199e0 | ||
|
|
e7bd42b07a | ||
|
|
b9248d774f | ||
|
|
763a09c5aa | ||
|
|
07987bc97c | ||
|
|
b59c238a83 | ||
|
|
9dfa5a8d9e | ||
|
|
3d0bdf694c | ||
|
|
b5c6e05ea0 | ||
|
|
cc2a478afc | ||
|
|
1dab8a1008 | ||
|
|
4facdaafc3 | ||
|
|
5190f65321 | ||
|
|
0335832574 | ||
|
|
b9f287ea52 | ||
|
|
28f98ecbf0 | ||
|
|
4e8c8ced0f | ||
|
|
5baef32925 | ||
|
|
cc8ca29980 | ||
|
|
e2405e2d00 | ||
|
|
1cba9bd634 | ||
|
|
e58e928af4 | ||
|
|
c3e842fc4c | ||
|
|
ab57984c04 | ||
|
|
a8dc2bbd25 | ||
|
|
bb838edb2f | ||
|
|
74b777612e | ||
|
|
ea4457878c | ||
|
|
1f3fb08086 | ||
|
|
702ca6af6e | ||
|
|
225a38b68a | ||
|
|
de756246e7 | ||
|
|
de67d5fe6d | ||
|
|
40332972ca | ||
|
|
47292301e7 | ||
|
|
7a5a21dacc | ||
|
|
04aaeef41d | ||
|
|
5a0bad4224 | ||
|
|
07f167eed3 | ||
|
|
b34aa49ceb | ||
|
|
f5dbd06b32 | ||
|
|
9bcd7c2fec | ||
|
|
7f2abce0d4 | ||
|
|
b7036ee04f | ||
|
|
36d25230e6 | ||
|
|
d298a327b5 | ||
|
|
8162166037 | ||
|
|
dbcf8de808 | ||
|
|
07893af4c5 | ||
|
|
2070231553 | ||
|
|
5b1971f1ef | ||
|
|
988bb4b365 | ||
|
|
64bfddc3a7 | ||
|
|
2a0397c1b2 | ||
|
|
decd9ac9fd | ||
|
|
a181afc699 | ||
|
|
a6db5788f6 | ||
|
|
d37e7cd513 | ||
|
|
6dd64214c2 | ||
|
|
96d3e0fd07 | ||
|
|
ac398b0e50 | ||
|
|
3f1f0657f6 | ||
|
|
abae0c8d21 | ||
|
|
892a599999 | ||
|
|
acbf69fdb6 | ||
|
|
566e886887 | ||
|
|
ae05e30eac | ||
|
|
310998435c | ||
|
|
647265bfd3 | ||
|
|
76af708b1f | ||
|
|
deb606ef59 | ||
|
|
721b294842 | ||
|
|
f40418cf9a | ||
|
|
b12dbd9f6a | ||
|
|
6087feef11 | ||
|
|
e7d652f208 | ||
|
|
51c3dd4cb1 | ||
|
|
8cf35658bd | ||
|
|
ee2b252418 | ||
|
|
45d320a434 | ||
|
|
76067ad5d2 | ||
|
|
15b0729181 | ||
|
|
23d30d9ea6 | ||
|
|
012e0abd22 | ||
|
|
225ee5072e | ||
|
|
384add2571 |
@@ -342,7 +342,7 @@ type.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">index_map</span></tt></td>
|
||||
<td>in</td>
|
||||
<td>Model of <a class="reference external" href="../../../property_map/doc/ReadablePropertyMap.html"><span class="concept">Readable Property Map</span></a>
|
||||
<td>Model of <a class="reference external" href="../../../property_map/ReadablePropertyMap.html"><span class="concept">Readable Property Map</span></a>
|
||||
with key type := <tt class="docutils literal"><span class="pre">graph</span></tt>'s
|
||||
vertex descriptor and value type
|
||||
an integer type.</td>
|
||||
@@ -350,7 +350,7 @@ an integer type.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">color_map</span></tt></td>
|
||||
<td>in/out</td>
|
||||
<td>Model of <a class="reference external" href="../../../property_map/doc/ReadWritePropertyMap.html"><span class="concept">Read/Write Property Map</span></a>
|
||||
<td>Model of <a class="reference external" href="../../../property_map/ReadWritePropertyMap.html"><span class="concept">Read/Write Property Map</span></a>
|
||||
with key type := <tt class="docutils literal"><span class="pre">graph</span></tt>'s
|
||||
vertex descriptor type.</td>
|
||||
<td>an <tt class="docutils literal"><span class="pre">iterator_property_map</span></tt>
|
||||
@@ -2150,7 +2150,7 @@ information on SFINAE.</td></tr>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr class="footer" />
|
||||
Generated on: 2009-05-31 01:40 UTC.
|
||||
Generated on: 2008-06-26 21:58 UTC.
|
||||
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
|
||||
|
||||
</div>
|
||||
|
||||
142
doc/index.rst
142
doc/index.rst
@@ -71,16 +71,16 @@ __ ../../../../index.htm
|
||||
-------------------------------------
|
||||
|
||||
:Authors: David Abrahams, Daniel Wallin
|
||||
:Contact: dave@boost-consulting.com, daniel@boostpro.com
|
||||
:organization: `BoostPro Computing`_
|
||||
:date: $Date: 2005/07/17 19:53:01 $
|
||||
:Contact: dave@boost-consulting.com, dalwan01@student.umu.se
|
||||
:Organization: `Boost Consulting`_
|
||||
:Date: $Date: 2005/07/18 20:34:31 $
|
||||
|
||||
:copyright: Copyright David Abrahams, Daniel Wallin
|
||||
2005-2009. Distributed under the Boost Software License,
|
||||
:Copyright: Copyright David Abrahams, Daniel Wallin 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)
|
||||
|
||||
.. _`BoostPro Computing`: http://www.boostpro.com
|
||||
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||
|
||||
.. _concepts: http://www.boost.org/more/generic_programming.html#concept
|
||||
|
||||
@@ -356,8 +356,8 @@ shown in the table below.
|
||||
.. _`IncidenceGraph`: ../../../graph/doc/IncidenceGraph.html
|
||||
.. _`VertexListGraph`: ../../../graph/doc/VertexListGraph.html
|
||||
.. _`DFSVisitor`: ../../../graph/doc/DFSVisitor.html
|
||||
.. _`ReadWritePropertyMap`: ../../../property_map/doc/ReadWritePropertyMap.html
|
||||
.. _`ReadablePropertyMap`: ../../../property_map/doc/ReadablePropertyMap.html
|
||||
.. _`ReadWritePropertyMap`: ../../../property_map/ReadWritePropertyMap.html
|
||||
.. _`ReadablePropertyMap`: ../../../property_map/ReadablePropertyMap.html
|
||||
|
||||
Don't be intimidated by the information in the second and third
|
||||
columns above. For the purposes of this exercise, you don't need
|
||||
@@ -1112,7 +1112,7 @@ be used within the body of a class::
|
||||
struct callable2
|
||||
{
|
||||
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int))))
|
||||
(void), operator(), tag, (required (arg1,(int))(arg2,(int))))
|
||||
{
|
||||
std::cout << arg1 << ", " << arg2 << std::endl;
|
||||
}
|
||||
@@ -1120,9 +1120,7 @@ be used within the body of a class::
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
#include <iostream>''')
|
||||
|
||||
.. @test('compile')
|
||||
|
||||
@@ -1133,7 +1131,7 @@ arguments on to a separate implementation function::
|
||||
struct callable2
|
||||
{
|
||||
BOOST_PARAMETER_CONST_MEMBER_FUNCTION(
|
||||
(void), call, tag, (required (arg1,(int))(arg2,(int))))
|
||||
(void), operator(), tag, (required (arg1,(int))(arg2,(int))))
|
||||
{
|
||||
call_impl(arg1,arg2);
|
||||
}
|
||||
@@ -1145,40 +1143,10 @@ arguments on to a separate implementation function::
|
||||
#include <boost/parameter.hpp>
|
||||
|
||||
BOOST_PARAMETER_NAME(arg1)
|
||||
BOOST_PARAMETER_NAME(arg2)
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
BOOST_PARAMETER_NAME(arg2)''')
|
||||
|
||||
.. @test('compile')
|
||||
|
||||
Static Member Functions
|
||||
=======================
|
||||
|
||||
To expose a static member function, simply insert the keyword
|
||||
“``static``” before the function name:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
BOOST_PARAMETER_NAME(arg1)
|
||||
|
||||
struct somebody
|
||||
{
|
||||
BOOST_PARAMETER_MEMBER_FUNCTION(
|
||||
(void), **static** f, tag, (optional (arg1,(int),0)))
|
||||
{
|
||||
std::cout << arg1 << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/parameter.hpp>
|
||||
#include <iostream>
|
||||
using namespace boost::parameter;
|
||||
''')
|
||||
|
||||
.. @test('compile')
|
||||
|
||||
|
||||
------------------------------
|
||||
Parameter-Enabled Constructors
|
||||
------------------------------
|
||||
@@ -1371,10 +1339,10 @@ separately)::
|
||||
using boost::mpl::_;
|
||||
|
||||
typedef parameter::parameters<
|
||||
required<tag::class_type, boost::is_class<_> >
|
||||
, parameter::optional<tag::base_list, mpl::is_sequence<_> >
|
||||
, parameter::optional<tag::held_type>
|
||||
, parameter::optional<tag::copyable>
|
||||
required<tag::class_type, is_class<_> >
|
||||
, optional<tag::base_list, mpl::is_sequence<_> >
|
||||
, optional<tag::held_type>
|
||||
, optional<tag::copyable>
|
||||
> class_signature;
|
||||
|
||||
}}
|
||||
@@ -1383,7 +1351,6 @@ separately)::
|
||||
#include <boost/parameter.hpp>
|
||||
#include <boost/mpl/is_sequence.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#include <memory>
|
||||
|
||||
using namespace boost::parameter;
|
||||
@@ -1410,13 +1377,12 @@ separately)::
|
||||
Argument Packs and Parameter Extraction
|
||||
---------------------------------------
|
||||
|
||||
Next, within the body of ``class_`` , we use the |ParameterSpec|\ 's
|
||||
nested ``::bind< … >`` template to bundle the actual arguments into an
|
||||
|ArgumentPack|_ type, and then use the library's ``value_type< … >``
|
||||
metafunction to extract “logical parameters”. ``value_type< … >`` is
|
||||
a lot like ``binding< … >``, but no reference is added to the actual
|
||||
argument type. Note that defaults are specified by passing it an
|
||||
optional third argument::
|
||||
Next, within the body of ``class_`` , we use the |ParameterSpec|\
|
||||
's nested ``::bind< … >`` template to bundle the actual arguments
|
||||
into an |ArgumentPack|_ type, and then use the library's ``binding<
|
||||
… >`` metafunction to extract “logical parameters”. Note that
|
||||
defaults are specified by supplying an optional third argument to
|
||||
``binding< … >``::
|
||||
|
||||
namespace boost { namespace python {
|
||||
|
||||
@@ -1434,16 +1400,16 @@ optional third argument::
|
||||
args;
|
||||
|
||||
// Extract first logical parameter.
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::class_type>::type class_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::base_list, bases<> >::type base_list;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::held_type, class_type>::type held_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::copyable, void>::type copyable;
|
||||
};
|
||||
|
||||
@@ -1545,12 +1511,12 @@ parameters deducible::
|
||||
typedef parameter::parameters<
|
||||
required<tag::class_type, is_class<_> >
|
||||
|
||||
, parameter::optional<
|
||||
, optional<
|
||||
deduced<tag::base_list>
|
||||
, is_base_and_derived<detail::bases_base,_>
|
||||
>
|
||||
|
||||
, parameter::optional<
|
||||
, optional<
|
||||
deduced<tag::held_type>
|
||||
, mpl::not_<
|
||||
mpl::or_<
|
||||
@@ -1560,12 +1526,11 @@ parameters deducible::
|
||||
>
|
||||
>
|
||||
|
||||
, parameter::optional<deduced<tag::copyable>, is_same<noncopyable,_> >
|
||||
, optional<deduced<tag::copyable>, is_same<noncopyable,_> >
|
||||
|
||||
> class_signature;
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
namespace boost { namespace python {''')
|
||||
|
||||
.. @example.append('''
|
||||
@@ -1583,16 +1548,16 @@ parameters deducible::
|
||||
args;
|
||||
|
||||
// Extract first logical parameter.
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::class_type>::type class_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::base_list, bases<> >::type base_list;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::held_type, class_type>::type held_type;
|
||||
|
||||
typedef typename parameter::value_type<
|
||||
typedef typename parameter::binding<
|
||||
args, tag::copyable, void>::type copyable;
|
||||
};
|
||||
|
||||
@@ -1813,13 +1778,15 @@ function template and allow *it* to do type deduction::
|
||||
Occasionally one needs to deduce argument types without an extra
|
||||
layer of function call. For example, suppose we wanted to return
|
||||
twice the value of the ``index`` parameter? In that
|
||||
case we can use the ``value_type< … >`` metafunction introduced
|
||||
case we can use the ``binding< … >`` metafunction introduced
|
||||
`earlier`__::
|
||||
|
||||
BOOST_PARAMETER_NAME(index)
|
||||
|
||||
template <class ArgumentPack>
|
||||
typename parameter::value_type<ArgumentPack, tag::index, int>::type
|
||||
typename remove_reference<
|
||||
typename parameter::binding<ArgumentPack, tag::index, int>::type
|
||||
>::type
|
||||
twice_index(ArgumentPack const& args)
|
||||
{
|
||||
return 2 * args[_index|42];
|
||||
@@ -1833,20 +1800,39 @@ case we can use the ``value_type< … >`` metafunction introduced
|
||||
#include <cassert>
|
||||
|
||||
namespace parameter = boost::parameter;
|
||||
''')
|
||||
using boost::remove_reference;''')
|
||||
|
||||
Note that the ``remove_reference< … >`` dance is necessary because
|
||||
``binding< … >`` will return a reference type when the argument
|
||||
is bound in the argument pack. If we don't strip the reference we
|
||||
end up returning a reference to the temporary created in the ``2 * …``
|
||||
expression. A convenient shortcut would be to use the ``value_type< … >``
|
||||
metafunction:
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
template <class ArgumentPack>
|
||||
typename **parameter::value_type<ArgumentPack, tag::index, int>**::type
|
||||
twice_index(ArgumentPack const& args)
|
||||
{
|
||||
return 2 * args[_index|42];
|
||||
}
|
||||
|
||||
.. @example.wrap('namespace with_value_type {', '''
|
||||
int six = twice_index(_index = 3);
|
||||
}''')
|
||||
|
||||
.. TODO: binding<> returns a reference. We should use value_type<> here.
|
||||
|
||||
.. @example.append('''
|
||||
int main()
|
||||
{
|
||||
assert(six == 6);
|
||||
assert(with_value_type::six == 6);
|
||||
}''')
|
||||
|
||||
.. @test('run', howmany='all')
|
||||
|
||||
Note that if we had used ``binding< … >`` rather than ``value_type< …
|
||||
>``, we would end up returning a reference to the temporary created in
|
||||
the ``2 * …`` expression.
|
||||
|
||||
__ binding_intro_
|
||||
|
||||
Lazy Default Computation
|
||||
@@ -1902,10 +1888,12 @@ object.
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
using boost::bind;
|
||||
using boost::ref;
|
||||
|
||||
typename parameter::binding<
|
||||
ArgumentPack, tag::s3, std::string
|
||||
>::type s3 = args[_s3
|
||||
**|| boost::bind(std::plus<std::string>(), boost::ref(s1), boost::ref(s2))** ];
|
||||
>::type s3 = args[_s3 **|| bind(std::plus<std::string>(), ref(s1), ref(s2))** ];
|
||||
|
||||
.. @example.prepend('''
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
The Boost Parameter Library Python Binding Documentation
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
:Authors: David Abrahams, Daniel Wallin
|
||||
:Contact: dave@boost-consulting.com, daniel@boostpro.com
|
||||
:organization: `BoostPro Computing`_
|
||||
:Authors: Daniel Wallin
|
||||
:Contact: dalwan01@student.umu.se
|
||||
:organization: `Boost Consulting`_
|
||||
:date: $Date$
|
||||
|
||||
:copyright: Copyright David Abrahams, Daniel Wallin
|
||||
2005-2009. Distributed under the Boost Software License,
|
||||
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)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
__ ../../../../index.htm
|
||||
|
||||
.. _`BoostPro Computing`: http://www.boostpro.com
|
||||
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||
|
||||
|
||||
.. role:: class
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
:Authors: David Abrahams, Daniel Wallin
|
||||
:Contact: dave@boost-consulting.com, daniel@boostpro.com
|
||||
:organization: `BoostPro Computing`_
|
||||
:Contact: dave@boost-consulting.com, dalwan01@student.umu.se
|
||||
:organization: `Boost Consulting`_
|
||||
:date: $Date: 2005/07/17 19:53:01 $
|
||||
|
||||
:copyright: Copyright David Abrahams, Daniel Wallin
|
||||
2005-2009. Distributed under the Boost Software License,
|
||||
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)
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
__ ../../../../index.htm
|
||||
|
||||
.. _`BoostPro Computing`: http://www.boostpro.com
|
||||
.. _`Boost Consulting`: http://www.boost-consulting.com
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <boost/parameter/aux_/default.hpp>
|
||||
#include <boost/parameter/aux_/parameter_requirements.hpp>
|
||||
#include <boost/parameter/aux_/yesno.hpp>
|
||||
#include <boost/parameter/aux_/is_maybe.hpp>
|
||||
#include <boost/parameter/aux_/maybe.hpp>
|
||||
#include <boost/parameter/config.hpp>
|
||||
|
||||
#include <boost/mpl/apply.hpp>
|
||||
@@ -22,11 +22,12 @@
|
||||
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/facilities/intercept.hpp>
|
||||
|
||||
namespace boost { namespace parameter {
|
||||
namespace boost { namespace parameter {
|
||||
|
||||
// Forward declaration for aux::arg_list, below.
|
||||
template<class T> struct keyword;
|
||||
@@ -46,7 +47,7 @@ struct lambda_tag;
|
||||
// declarations to build member function overload sets that can
|
||||
// match against keywords.
|
||||
//
|
||||
|
||||
|
||||
// MPL sequence support
|
||||
struct arg_list_tag;
|
||||
|
||||
@@ -83,14 +84,14 @@ struct empty_arg_list
|
||||
template <class KW>
|
||||
static no_tag has_key(KW*);
|
||||
#endif
|
||||
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) \
|
||||
|| (BOOST_WORKAROUND(__GNUC__, < 3)) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
|
||||
|
||||
// The overload set technique doesn't work with these older
|
||||
// compilers, so they need some explicit handholding.
|
||||
|
||||
|
||||
// A metafunction class that, given a keyword, returns the type
|
||||
// of the base sublist whose get() function can produce the
|
||||
// value for that key
|
||||
@@ -159,6 +160,11 @@ no_tag operator*(empty_arg_list, KW*);
|
||||
template <class KW, class T>
|
||||
struct tagged_argument;
|
||||
|
||||
template <class T>
|
||||
struct is_maybe
|
||||
: is_base_and_derived<maybe_base, T>
|
||||
{};
|
||||
|
||||
template <class T>
|
||||
struct get_reference
|
||||
{
|
||||
@@ -206,9 +212,9 @@ struct arg_list : Next
|
||||
// Create a new list by prepending arg to a copy of tail. Used
|
||||
// when incrementally building this structure with the comma
|
||||
// operator.
|
||||
arg_list(TaggedArg head, Next const& tail)
|
||||
arg_list(TaggedArg arg, Next const& tail)
|
||||
: Next(tail)
|
||||
, arg(head)
|
||||
, arg(arg)
|
||||
{}
|
||||
|
||||
// A metafunction class that, given a keyword and a default
|
||||
@@ -236,8 +242,8 @@ struct arg_list : Next
|
||||
// same keyword is used again
|
||||
static yes_tag has_key(key_type*);
|
||||
using Next::has_key;
|
||||
|
||||
# define BOOST_PARAMETER_CALL_HAS_KEY(next, key) next::has_key((key*)0)
|
||||
|
||||
# define BOOST_PARAMETER_CALL_HAS_KEY(next, key) next::has_key((key*)0)
|
||||
# endif
|
||||
|
||||
BOOST_MPL_ASSERT_MSG(
|
||||
@@ -252,7 +258,7 @@ struct arg_list : Next
|
||||
// specific arguments by name
|
||||
//
|
||||
|
||||
// Helpers that handle the case when TaggedArg is
|
||||
// Helpers that handle the case when TaggedArg is
|
||||
// empty<T>.
|
||||
template <class D>
|
||||
reference get_default(D const&, mpl::false_) const
|
||||
@@ -332,7 +338,7 @@ struct arg_list : Next
|
||||
template <class Default>
|
||||
reference get(default_<key_type,Default> const& d) const
|
||||
{
|
||||
return get_default(d, holds_maybe());
|
||||
return get_default(d, holds_maybe());
|
||||
}
|
||||
|
||||
template <class Default>
|
||||
@@ -340,7 +346,7 @@ struct arg_list : Next
|
||||
{
|
||||
return arg.value;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
reference operator[](keyword<key_type> const&) const
|
||||
@@ -395,7 +401,7 @@ struct arg_list : Next
|
||||
// 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>
|
||||
arg_list<tagged_argument<KW, T2>, self>
|
||||
operator,(tagged_argument<KW,T2> x) const
|
||||
{
|
||||
return arg_list<tagged_argument<KW,T2>, self>(x, *this);
|
||||
@@ -409,7 +415,7 @@ struct arg_list : Next
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // ETI workaround
|
||||
template <> struct arg_list<int,int> {};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// MPL sequence support
|
||||
template <class ArgumentPack>
|
||||
@@ -419,7 +425,7 @@ struct arg_list_iterator
|
||||
|
||||
// The incremented iterator
|
||||
typedef arg_list_iterator<typename ArgumentPack::tail_type> next;
|
||||
|
||||
|
||||
// dereferencing yields the key type
|
||||
typedef typename ArgumentPack::key_type type;
|
||||
};
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright Daniel Wallin, David Abrahams 2010. Use, modification and
|
||||
// distribution is subject to 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)
|
||||
|
||||
#ifndef BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
#define BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace parameter {
|
||||
namespace aux {
|
||||
|
||||
struct maybe_base {};
|
||||
|
||||
template <class T>
|
||||
struct is_maybe
|
||||
: is_base_and_derived<maybe_base, T>
|
||||
{};
|
||||
|
||||
} // namespace aux
|
||||
} // namespace parameter
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_PARAMETER_IS_MAYBE_050329_HPP
|
||||
@@ -2,41 +2,21 @@
|
||||
// subject to 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)
|
||||
|
||||
//
|
||||
// 2009.10.21 TDS remove depenency on boost::python::detail::referent_storage
|
||||
//
|
||||
#ifndef BOOST_PARAMETER_MAYBE_091021_HPP
|
||||
# define BOOST_PARAMETER_MAYBE_091021_HPP
|
||||
#ifndef BOOST_PARAMETER_MAYBE_060211_HPP
|
||||
# define BOOST_PARAMETER_MAYBE_060211_HPP
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/identity.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
# include <boost/optional.hpp>
|
||||
# include <boost/aligned_storage.hpp>
|
||||
# include <boost/python/detail/referent_storage.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/type_traits/add_const.hpp>
|
||||
# include <boost/parameter/aux_/is_maybe.hpp>
|
||||
|
||||
namespace boost { namespace parameter { namespace aux {
|
||||
|
||||
template <class T> struct referent_size;
|
||||
|
||||
template <class T>
|
||||
struct referent_size<T&>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(std::size_t, value = sizeof(T));
|
||||
};
|
||||
|
||||
// A metafunction returning a POD type which can store U, where T ==
|
||||
// U&. If T is not a reference type, returns a POD which can store T.
|
||||
template <class T>
|
||||
struct referent_storage
|
||||
{
|
||||
typedef typename boost::aligned_storage<
|
||||
referent_size<T>::value
|
||||
>::type type;
|
||||
};
|
||||
struct maybe_base {};
|
||||
|
||||
template <class T>
|
||||
struct maybe : maybe_base
|
||||
@@ -44,17 +24,17 @@ struct maybe : maybe_base
|
||||
typedef typename add_reference<
|
||||
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
T const
|
||||
# else
|
||||
# else
|
||||
typename add_const<T>::type
|
||||
# endif
|
||||
# endif
|
||||
>::type reference;
|
||||
|
||||
|
||||
typedef typename remove_cv<
|
||||
BOOST_DEDUCED_TYPENAME remove_reference<reference>::type
|
||||
>::type non_cv_value;
|
||||
|
||||
explicit maybe(T value_)
|
||||
: value(value_)
|
||||
|
||||
explicit maybe(T value)
|
||||
: value(value)
|
||||
, constructed(false)
|
||||
{}
|
||||
|
||||
@@ -68,28 +48,28 @@ struct maybe : maybe_base
|
||||
this->destroy();
|
||||
}
|
||||
|
||||
reference construct(reference value_) const
|
||||
reference construct(reference value) const
|
||||
{
|
||||
return value_;
|
||||
return value;
|
||||
}
|
||||
|
||||
template <class U>
|
||||
reference construct2(U const& value_) const
|
||||
reference construct2(U const& value) const
|
||||
{
|
||||
new (m_storage.address()) non_cv_value(value_);
|
||||
new (m_storage.bytes) non_cv_value(value);
|
||||
constructed = true;
|
||||
return *(non_cv_value*)m_storage.address();
|
||||
return *(non_cv_value*)m_storage.bytes;
|
||||
}
|
||||
|
||||
template <class U>
|
||||
reference construct(U const& value_) const
|
||||
reference construct(U const& value) const
|
||||
{
|
||||
return this->construct2(value_);
|
||||
return this->construct2(value);
|
||||
}
|
||||
|
||||
void destroy()
|
||||
{
|
||||
((non_cv_value*)m_storage.address())->~non_cv_value();
|
||||
((non_cv_value*)m_storage.bytes)->~non_cv_value();
|
||||
}
|
||||
|
||||
typedef reference(maybe<T>::*safe_bool)() const;
|
||||
@@ -107,9 +87,7 @@ struct maybe : maybe_base
|
||||
private:
|
||||
boost::optional<T> value;
|
||||
mutable bool constructed;
|
||||
|
||||
|
||||
mutable typename referent_storage<
|
||||
mutable typename boost::python::detail::referent_storage<
|
||||
reference
|
||||
>::type m_storage;
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
# include <boost/preprocessor/repetition/repeat_from_to.hpp>
|
||||
# include <boost/preprocessor/comparison/equal.hpp>
|
||||
# include <boost/preprocessor/control/if.hpp>
|
||||
# include <boost/preprocessor/control/iif.hpp>
|
||||
# include <boost/preprocessor/control/expr_if.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
@@ -27,7 +26,6 @@
|
||||
# include <boost/preprocessor/tuple/elem.hpp>
|
||||
# include <boost/preprocessor/tuple/eat.hpp>
|
||||
# include <boost/preprocessor/seq/fold_left.hpp>
|
||||
# include <boost/preprocessor/seq/push_back.hpp>
|
||||
# include <boost/preprocessor/seq/size.hpp>
|
||||
# include <boost/preprocessor/seq/enum.hpp>
|
||||
# include <boost/preprocessor/seq/push_back.hpp>
|
||||
@@ -363,7 +361,7 @@ struct funptr_predicate<void**>
|
||||
# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n) \
|
||||
, typename boost::parameter::aux::match< \
|
||||
parameters, BOOST_PP_ENUM_PARAMS(n, ParameterArgumentType) \
|
||||
>::type = parameters()
|
||||
>::type boost_parameter_enabler_argument = parameters()
|
||||
# else
|
||||
# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n)
|
||||
# endif
|
||||
|
||||
Reference in New Issue
Block a user