Copyright © 2007 Shunsuke Sogame
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)
Table of Contents
“An Egg to day is better than a Hen to-morrow.” -- Benjamin Franklin
Unlike other modern languages, it is very difficult to make a function in C++ especially if you want to support Boost.ResultOf and Boost.Lambda. Egg is a small header-only framework of building functions, and offers higher-order functions.
#include <pstade/egg/pipable.hpp> using namespace pstade::egg; // This adaptation incurs no runtime overhead. result_of_pipable<int(*)(int)>::type const to_upper = PSTADE_EGG_PIPABLE(&toupper); void test() { int maybeI = 'i'|to_upper|pipable(&tolower)|to_upper(); BOOST_CHECK(maybeI == 'I'); }
Egg is known to work on the following platforms:
This document uses the following notation.
Valid expression |
Semantics |
---|---|
|
An imaginary operator which is the same as |
|
|
|
|
|
|
|
A Polymorphic Function Object type which is neither reference nor cv-qualified. |
|
A Little Function object |
|
A Little Function type which is neither reference nor cv-qualified. |
|
A type which is one of the Forwarding Strageties. |
|
|
|
|
|
An imaginary operator to concatenate tokens. |
Also, assume that every expression is placed after:
namespace egg = pstade::egg; using namespace egg;
Last revised: January 03, 2008 at 16:31:35 GMT |