2010-09-16から1日間の記事一覧

C++0xでOvenのregular書いた。

C++

関数(オブジェクト)をshared_ptrでラップしてindirectするだけだろ、と思ってたらものすごくたいへんでしたの巻。 // gcc-4.6-20100911, std=c++0x #include <iostream> #include <vector> #include <utility> #include <boost/shared_ptr.hpp> #include <boost/range.hpp> #include <boost/range/adaptor/filtered.hpp> namespace shand { template <class F> struct i…</class></boost/range/adaptor/filtered.hpp></boost/range.hpp></boost/shared_ptr.hpp></utility></vector></iostream>

Re:文字列バラバラ事件

C++

文字列バラバラ事件 それmpl::for_eachで。 #include <iostream> #include <boost/mpl/string.hpp> #include <boost/mpl/for_each.hpp> namespace mpl = boost::mpl; struct print { void operator()(char c) const { std::cout << c << std::endl; } }; int main() { typedef mpl::string<'test'> test; mpl::for_each<test></test></boost/mpl/for_each.hpp></boost/mpl/string.hpp></iostream>…