Egg provides some workaround utilities.
boost::result_of
has some problems especially
under Boost1.34 or below:
boost::result_of
can't take a cv-qualified
function pointer as the target function.
boost::result_of
can't take POD template as the target function.
So that, Egg provides its own "result_of" with slightly different name.
Caution | |
---|---|
If you already use Boost1.35 and don't pass a cv-qualified function pointer, you don't need this workaround. |
Note | |
---|---|
The former bug can probably be worked around by applying a patch to Boost.ResultOf. |
<boost/egg/result_of.hpp>
Valid expression |
Semantics |
---|---|
|
|
BOOST_MPL_HAS_XXX_TRAIT_DEF
,
which Boost.ResultOf and Boost.Lambda depend on, sometimes fails to
work under the msvc compilers. When you see a weird error message such that
"nested sig
template
is undefined" or "nested result
template is undefined", use this header.
Note | |
---|---|
This bug can probably be worked around by applying a patch to Boost.Lambda and Boost.ResultOf. |
<boost/egg/detect_result_type.hpp>
Valid expression |
Semantics |
---|---|
|
Turns on the workaround. |
<boost/egg/detect_result_type.hpp>
must be included before any Boost headers.
When you define a Function Object in namespace scope, GCC might show unused variable warnings without this macro.
Tip | |
---|---|
Strictly speaking, a const-qualified object in namespace scope incurs ODR(One Definition Rule) violation. Though a conforming workaround is found, even GCC can't do the right thing around address constant expression. Anyway, it is unlikely for this violation to cause significant problem. |
<boost/egg/const.hpp>
Valid expression |
Semantics |
---|---|
|
|
F
is POD
which is not cv-qualified.
BOOST_EGG_CONST((T_foo), foo) = &foo_impl;
Under GCC 3.4.x, when you overload call
in Little Function
with the same arity, the following workaround is needed to disambiguate overload
resolution.
<boost/egg/overloaded.hpp>
Valid expression |
Semantics |
---|---|
|
Turns on the workaround. |
|
Helps overload resolution. |
BOOST_EGG_OVERLOADED_PREAMBLE()
is placed first in Little
Function.
BOOST_EGG_OVERLOADED(R)
is
placed first in parameter list of every call
.
R
is return type of call
.
struct little_foo { BOOST_EGG_OVERLOADED_PREAMBLE() template<class Me, class A1> struct apply { typedef A1 &type; }; template<class Re, class A1> Re call(BOOST_EGG_OVERLOADED(Re) A1 &a1) const { return a1; } template<class Re, class A1> Re call(BOOST_EGG_OVERLOADED(Re) A1 const &a1) const { return a1; } };