C++ Boost

Boost.dynamic_any

Header < boost/dynamic_any/function.hpp>


Contents

Introduction
Classes
Template class function
Template class function synopsis
Functions
{{function name}}
Objects
{{object name}}
Example(s)

Introduction

Classes

Template class function

Signature

Signature is a function type used to designate the result and the arguments of the template class function. There are four special anyT-based types: anyT, const anyT, anyT& and const anyT&. They are used to indicate that the argument or the result has type any<OperationList> or a reference to any<OperationList> (possibly const-qualified). Template argument OperationList is deduced from actual arguments of the function call operator. Therefore, Signature must have at least one anyT-based argument.

[Example: Signature const anyT(int,anyT&) is resolved as const any<OperationList>(int,any<OperationList>&) during a function call. ]

Template class function synopsis

namespace boost { namespace dynamic_any {

  class anyT {};

  template<class EndFunction, class Signature>
  class function
  {
    public:

      typedef Signature signature;

      static const std::size_t arity = function_traits<Signature>::arity;

      template<class OperationList>
      result operator()(Arg1,...,ArgN) const;

      template<class OperationList>
      result no_call(Arg1,...,ArgN) const
      {
          throw bad_function_call();
      }

      template<class T, class OperationList>
      result call_ex(Arg1 a1,...,ArgM aM) const
      {
          return static_cast<const EndFunction*>(this)->call(a1,...,aK);
      }
  };

} } // namespace boost { namespace dynamic_any {

EndFunction

Template class function should never been used directly. Instead, a user-defined function must be derived from it. Template agrument EndFunction

[Example:

class sizeof_ : public function<
                    sizeof_, // curiously recurring template pattern
                    std::size_t (const anyT&)
                >
{
  public:
    template<class T> std::size_t call(const T&) const
    {
        return sizeof(T);
    }
};
--end example. ]

Template class function functions

template<class OperationList>
result operator()(Arg1,...,ArgN) const;
template<class OperationList>
result no_call(Arg1,...,ArgN) const;
template<class T, class OperationList>
result call_ex(Arg1 a1,...,ArgM aM) const;
Requires:
Effects:
Postconditions: {{text}}
Returns: {{text}}
Throws: {{text}}
Complexity: {{text}}
Note: {{text}}
Danger: {{text}}
Rationale: {{text}}
Requires: {{text}}
Effects: {{text}}
Postconditions: {{text}}
Returns: {{text}}
Throws: {{text}}
Complexity: {{text}}
Note: {{text}}
Danger: {{text}}
Rationale: {{text}}

Functions

{{function}}
Requires: {{text}}
Effects: {{text}}
Postconditions: {{text}}
Returns: {{text}}
Throws: {{text}}
Complexity: {{text}}
Note: {{text}}
Danger: {{text}}
Rationale: {{text}}

Objects

{{Object specifications}}

Example(s)

{{Example(s)}}

Revised 05 November, 2001

© Copyright Alexander Nasonov 2002-2003. All Rights Reserved.