Author: | David Abrahams |
---|---|
Author: | Daniel Wallin |
Contact: | dave@boost-consulting.com, dalwan01@student.umu.se |
Organization: | Boost Consulting |
Date: | 2005-07-17 |
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) |
template <class Tag> struct keyword { template <class T> ArgumentPack operator=(T& value) const; template <class T> ArgumentPack operator=(T const& value) const; template <class T> ArgumentPack operator|(T& default_) const; template <class T> KeywordDefaultExpression operator|(T const& default_) const; template <class F> KeywordDefaultExpression operator||(F const&) const; };
template <class T> ArgumentPack operator=(T& value) const; template <class T> ArgumentPack operator=(T const& value) const;
template <class T> KeywordDefaultExpression operator|(T& x) const; template <class T> KeywordDefaultExpression operator|(T const& x) const;
template <class F> KeywordDefaultExpression operator||(F const& fn) const;
In the next two tables, fn is an object of type F.
template <class P0, class P1, …, class PN> struct parameters { template <class T0, class T1, …, class TN> struct match { typedef … type; }; template <class A0> ArgumentPack operator()(A0 const& a0) const; template <class A0, class A1> ArgumentPack operator()(A0 const& a0, A1 const& a1) const; template <class A0, class A1, …, class AN> ArgumentPack operator()(A0 const& a0, A1 const& a1, …, AN const& aN) const; };
<P0, …, PN> are models of ParameterSpec. If Px is not an instance of either optional or required, it is treated as a keyword tag with the same meaning as optional<Px>.
Used to remove a function from overload resolution using SFINAE.
template <class T0, class T1, …, class TN> struct restrict { typedef … type; };
template <class A0> ArgumentPack operator()(A0 const& a0) const; template <class A0, class A1> ArgumentPack operator()(A0 const& a0, A1 const& a1) const; …
template <class Tag, class Predicate = unspecified> struct optional; template <class Tag, class Predicate = unspecified> struct required;
A metafunction that, given an ArgumentPack, returns the reference type of the parameter identified by Keyword. If no such parameter has been specified, returns Default.
template <class Parameters, class Keyword, class Default = unspecified> struct binding { typedef … type; };
A metafunction that, given an ArgumentPack, returns the reference type of the parameter identified by Keyword. If no such parameter has been specified, returns the type returned by invoking DefaultFn.
template <class Parameters, class Keyword, class DefaultFn> struct lazy_binding { typedef … type; };
DefaultFn is a nullary function object. The type returned by invoking this function is determined by boost::result_of<DefaultFn()>::type on compilers that support partial specialization. On less compliant compilers a nested DefaultFn::result_type is used instead.
Models of these concepts are used as indices in a ArgumentPack. Models of KeywordDefaultExpression will hold a default value to be used when no appropriate argument was passed.
A KeywordDefaultExpression may contain a lazy default, meaning it's default value is only computed when needed.
Models of this concept are containers of parameters where each parameter is tagged with a keyword.
Expression | Type | Requirements | Semantics/Notes |
---|---|---|---|
x[y] | binding<X, K>::type | An argument tagged with K exists in x. | Returns the bound argument tagged with K. |
x[u] | binding<X, K, D>::type | - | Returns the bound argument tagged with K if such an argument exists. Otherwise returns the default value of u. If u has a lazy default, this may throw whatever the default value function of u throws when x does not contain an argument tagged with K. |
x, z | Model of ArgumentPack | - | Returns a composite ArgumentPack that contains bindings to all arguments bound in x and z. |
Used to describe type restrictions and positional meaning in a parameter set.
Models of this concept with special meaning are:
Any other type will be treated as a keyword Tag.
Macro used to define keyword objects.
BOOST_PARAMETER_KEYWORD(tag_namespace, name)
BOOST_PARAMETER_FUN(ret, name, lo, hi, parameters)