From f7631d89a79b7870e495ffba0c6ef0b75fb6fd36 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Mon, 8 Nov 2004 13:28:17 +0000 Subject: [PATCH] reference docs for named_params, incomplete [SVN r2337] --- doc/named_params_ref.rst | 192 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100755 doc/named_params_ref.rst diff --git a/doc/named_params_ref.rst b/doc/named_params_ref.rst new file mode 100755 index 0000000..6e97675 --- /dev/null +++ b/doc/named_params_ref.rst @@ -0,0 +1,192 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + The Boost.NamedParams Library Reference |(logo)|__ INCOMPLETE ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +.. |(logo)| image:: ../../../c++boost.gif + :alt: Boost + :class: boost-logo + +__ ../../../index.htm + +------------------------------------- + +:Authors: David Abrahams, Daniel Wallin +:Contact: dave@boost-consulting.com, dalwan01@student.umu.se +:organizations: `Boost Consulting`_, +:date: $Date$ +:copyright: Copyright David Abrahams, Daniel Wallin 2003. +:license: 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) + +.. _`Boost Consulting`: http://www.boost-consulting.com + +.. contents:: + +concept ``keyword-expression`` +------------------------------ + +.. parsed-literal:: + + template + *bound-argument* operator[](*keyword-expression*, keyword) + +**Requires** + An argument tagged with ``Tag`` must be bound in the object. + +**Returns** + A reference to the bound argument tagged with ``Tag``. + +**Throws** + Nothrow. + +**Complexity** + O(1) runtime. O(1) compile time on good compilers. O(N), where N is + the number of bound arguments, on old compilers such as VC6. + + +.. parsed-literal:: + + *bound-argument* operator[](*keyword-expression*, *named-default-expression*) + +**Requires** + Nothing. + +**Returns** + A reference to the bound argument tagged with + *named-default-expression*::key_type. If no such argument is bound, the + default value as given by the *named-default-expression* instance is + returned. + +**Throws** + Nothrow. + +**Complexity** + O(1) runtime. O(1) compile time on good compilers. O(N), where N is + the number of bound arguments, on old compilers such as VC6. + + +concept ``named-default-expression`` +------------------------------------ + +... + + +concept ``lazy-default-expression`` +----------------------------------- + +... + + + +class template ``keyword`` +-------------------------- + +.. parsed-literal:: + + template + struct keyword + { + template + *keyword-expression* operator=(T&) const; + + template + *keyword-expression* operator=(T const&) const; + + template + *named-default-expression* operator|(Default&) const; + + template + *named-default-expression* operator|(Default const&) const; + + template + *unspecified* operator||(LazyDefault const&) const; + }; + +Denotes a argument keyword. ``Tag`` is a tag class, typically an incomplete type. + +:: + + template operator=(T&) + template operator=(T const&) + +**Requires** + Nothing. + +**Returns** + An object that holds a cv reference to ``x``, tagged with the keyword + ``Tag`` type. If ``T`` is an instance of ``boost::reference_wrapper`` + the tagged result will hold a reference to ``U cv``. + +**Complexity** + O(1) compile time and run time. + +**Throws** + Nothrow. + +.. parsed-literal:: + + template + *named-default-expression* operator|(Default&) const + + template + *named-default-expression* operator|(Default const&) const + +**Requires** + Nothing. + +**Returns** + An object holding a reference to the given default value, tagged + with ``Tag``. + +.. parsed-literal:: + + template + *lazy-default-expression* operator||(LazyDefault const& x) const; + +**Requires** + ``LazyDefault`` is a nullary function object, with the following + properties: + + ======================== ======================================= + Expression Result + ======================== ======================================= + LazyDefault::result_type Must to Copyable + x() Convertible to LazyDefault::result_type + ======================== ======================================= + +**Returns** + ... + +.. parsed-literal:: + + template< + class Tag + , class HasDefault = mpl::true\_ + , class Predicate = mpl::always + > + struct named_param + { + typedef Tag key_type; + typedef HasDefault has_default; + typedef Predicate predicate; + }; + + template + struct keywords + { + template + *keyword-expression* operator()(T0 const&, T1 const&, ..., TN const&) const; + }; + +* is either a tag type, as specified in ``keyword``, or an instantiation of + ``named_param``. + +:: + + template operator()(T0 const&, T1 const&, ..., TN const&) const; + +Composes all parameters, named and positional, into an object that can be used to query +for specific keywords. +