Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
Boost
Edit
PageHistory
Diff
Info
LikePages
Boost is an interesting set of [C++] libraries that can be found at [http://www.boost.org/]. It provides all sorts, from lambda functions to regular expressions. A full list of the libraries included can be found at [http://www.boost.org/libs/libraries.htm]. Boost is an example of some of the amazing things which can be accomplised with templates and C++. A few examples shamelessly ripped from the documentation. ---- Lambda functions: list<int> v(10); for_each(v.begin(), v.end(), _1 = 1); The expression _1 = 1 creates a lambda functor which assigns the value 1 to every element in v. vector<int*> vp(10); sort(vp.begin(), vp.end(), *_1 > *_2); In this call to sort, we are sorting the elements by their contents in descending order. ---- Yes, this is still [C++]. For those interested in Python, perhaps Boost.Python is somewhat useful: C++ code: struct World { World(std::string msg): msg(msg) {} // added constructor void set(std::string msg) { this->msg = msg; } std::string greet() { return msg; } std::string msg; }; And exporting the class: #include <boost/python.hpp> using namespace boost::python; BOOST_PYTHON_MODULE(hello) { class_<World>("World", init<std::string>()) .def("greet", &World::greet) .def("set", &World::set) ; } And what it is like in Python: >>> import hello >>> planet = hello.World() >>> planet.set('howdy') >>> planet.greet() 'howdy' ---- Not all compilers are able to compile Boost. An interesting read is [http://www.boost.org/status/compiler_status.html] where there are tests done on each compiler to see whether they are able to compile all the boost test cases. Boost used a modified Jam as its build system rather than Makefiles.
One page links to
Boost
:
StandardTemplateLibrary