pstade

PrevUpHomeNext

Utilities

apply
bll_bind
bll_N
bll/result_of.hpp
infix
tuple_get
tuple_pack

It is difficult or even impossible to get a Function Object from a function template. Egg no longer considers function templates to be useful, so that it provides "objectified" functions which replace some famous function templates.

Description

apply calls a function with trailing arguments.

Header
  • <pstade/egg/apply.hpp>
Model of
Notation
  • ...
Valid expressions

Valid expression

Semantics

X_apply<_Stg = _default>

A Major Function Object type

X_apply<_Stg>()(_pfo, a1,...,aN)

_pfo(_arg_list(a, _Stg))

apply

X_apply<>()

Preconditions
  • _arg_list(b, _Stg) is a valid expression, where b is _pfo, a1,...,aN.
  • The corresponding semantics is a valid expression.
Example

BOOST_CHECK(apply(negate, apply(negate, apply(negate, 10))) == -10);

See also
Description

bll_bind is a Static Function Object which represents boost::lambda::bind.

Header
  • <pstade/egg/bll/bind.hpp>
Model of
Notation
  • ...
Valid expressions

Valid expression

Semantics

bll_bind(f, a1,...,aN)

Polymorphic boost::lambda::bind(f, a1,...,aN)

Preconditions
  • 0 <= N && N <= 9.
  • The corresponding semantics is a valid expression.
Example

1// \x -> (\y -> plus(x, y))
BOOST_CHECK( lazy(bll_bind)(plus, _1, bll::protect(_1))
    (a)(b) == plus(a, b) );

1

This is currying in Boost.Lambda.

See also
Description

bll_N is a Static Function Object which represents boost::lambda::_N.

Header
  • <pstade/egg/bll/placeholders.hpp>
Model of
Notation
  • ...
Valid expressions

Valid expression

Semantics

bll_++N

Polymorphic boost::lambda::_++N

Preconditions
  • 1 <= N && N <= 3.
  • The corresponding semantics is a valid expression.
Example

...

See also
Description

This header lets a Boost.Lambda functor be a Polymorphic Function Object.

Header
  • <pstade/egg/bll/result_of.hpp>
Model of
  • ...
Notation
  • ...
Valid expressions

Valid expression

Semantics

#include <pstade/egg/bll/result_of.hpp>

A Boost.Lambda functor becomes a Polymorphic Function Object.

Preconditions
  • ...
Example

...

See also
Description

Egg provides FC++ infix operator syntax.

Header
  • <pstade/egg/infix.hpp>
Model of
  • ...
Notation
  • ...
Valid expressions

Valid expression

Semantics

a1 ^_pfo^ a2

_pfo(_arg_list(a1, by_perfect), _arg_list(a2, by_perfect))

Preconditions
  • using namespace infix; is placed before the valid expression.
  • The corresponding semantics is a valid expression.
Invariants
  • ^_pfo^ behaves as if it had left to right associativity.
Example
using namespace infix;
BOOST_CHECK( (10 ^plus^ 12 ^plus^ 3) == 25 );
See also
Description

tuple_get is akin to boost::get.

Header
  • <pstade/egg/tuple/get.hpp>
Model of
  • ...
Notation
  • ...
Valid expressions

Valid expression

Semantics

X_tuple_get<N>

A Major Function Object type

X_tuple_get<N>()(t)

boost::get<N::value>(t)

X_tuple_get_c<n>

X_tuple_get< boost::mpl::int_<n> >

egg::tuple_get<N>(t)

X_tuple_get<N>()(t)

egg::tuple_get_c<n>(t)

X_tuple_get_c<n>()(t)

Preconditions
  • The corresponding semantics is a valid expression.
Example

...

See also
Description

tuple_pack is a Static Function Object which represents boost::tie but const-qualifier sensitive.

Header
  • <pstade/egg/tuple/pack.hpp>
Model of
Notation
  • refs(c1,...,cK) is c1&,...,cK&.
Valid expressions

Valid expression

Semantics

X_tuple_pack<_Stg = _default>

A Major Function Object type

X_tuple_pack<_Stg>()(a1,...,aN)

boost::tuple<refs(_meta_arg_list(a, _Stg))>(_arg_list(a, _Stg))

tuple_pack

X_tuple_pack<>()

Preconditions
  • _Stg is not by_value.
  • The corresponding semantics is a valid expression.
Example

...

See also
Copyright 2007 Shunsuke Sogame

PrevUpHomeNext