Home | Libraries | People | FAQ | More |
Table of Contents
In this section we briefly describe the relationship between FC++ and other C++ libraries.
The main interface to the STL is via iterators in the list class. FC++ lists, like STL containers, have a constructor which takes two iterators deliniating a range, so that the contents of an STL container can be (lazily) copied into a list. For example:
std::vector<int> v = ...; fcpp::list<int> l( v.begin(), v.end() ); // l is not yet evaulated; still holds iterators into v fcpp::length( l ); // force evaluation of entire list // now l has a true copy of the elements in vAdditionally, lists themselves have forward iterators:
for( fcpp::list<int>::iterator i = l.begin(); i != l.end(); ++i ) cout << *i; // print each element of list
In addition to fcpp::lists, there is also a class called fcpp::strict_list, which has the same structural interface as list, but does not do lazy evaluation. The library "list" functions work on any datatype which meets the FC++ "ListLike" concept, which includes list, odd_list, and strict_list. For many applications, strict_list may be the preferred datatype to use, as it avoids incurring the costs of lazy evaluation when that feature is not needed.
Monomorphic FC++ (unary or binary) functoids are STL "adaptables". The fcpp::ptr_to_fun() functoid promotes C++ function/method pointers into FC++ full functoids. The stl_to_funN functions turn STL adaptables into functoids.
Table of Contents
FC++ is related to a number of Boost libraries.
FC++'s lambda (see Section 12) and currying (Section 7) capabilities do approximately the same thing that boost::lambda and boost::bind do. These libraries were developed with different design rationales; for a description of the comparison, see [McN&Sma03].
Since FC++ supports the result_of method for return-type-deduction (see Section 7), FC++ interoperates with boost::lambda and boost::bind.
FC++ indirect functoids (Section 6) are similar to boost::function objects. Indirect functoids have all of FC++'s full functoids capabilities (like currying and infix syntax; see Section 7) built in. Indirect functoids can only pass parameters by value (actually, const&), though (see Section 16 for discussion on this point).
Last revised: October 03, 2003 at 23:27:22 GMT | Copyright © 2000-2003 Brian McNamara and Yannis Smaragdakis |