In the previous versions (prior to v1.5) of the FC++ library, to define a (say, 2-argument) functoid of your own, you would just say
struct MyFunctoid { // Sig information // operator(x,y) definition } myFunctoid;You would probably also choose to add currying capabilities by wrapping your functoids like so:
struct MyFunctoid { // Sig information // operator(x,y) definition }; Curryable2<MyFunctoid> myFunctoid;
Now with v1.5 of the library, we introduce a new type of wrapper called "full" functoids. Full functoids wrap existing functoids with all of the v1.5 library functionality, namely:
operator[]
calls)namespace impl { struct XMyFunctoid { // Sig information // operator(x,y) definition }; } typedef Full2<impl::XMyFunctoid> MyFunctoid; MyFunctoid myFunctoid;The
FullN
wrappers work just like the
CurryableN
wrappers. (The introduction of the
namespace
and the typedef
are
not strictly necessary, but using this idiom ensures
that the C++ type of someFunctoid
is always just
SomeFunctoid
(and not, say,
Full3<SomeFunctoid>
or
Curryable2<SomeFunctoid>
or whatever). Throughout
the library implementation we use this idiom to create a simple way to
name the C++ types of functoids.)
While wrapping your functoids in the FullN
wrappers is considered
optional, we recommend that you wrap all of your functoids this way.
Non-wrapped functoids will not be curryable, cannot participate fully in
lambda expressions, cannot use infix syntax, and cannot be used with
some of the library combinators.
full.h
, smart.h
, and
curry.h
.