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

boost::fusion::for_each

以前エントリした『boost::tuple で for_each のような処理』で、 id:gintenlaboさんから 「boost::fusion で出来るよ」 と、コメントを頂いたのでやってみました。 #include <string> #include <boost/fusion/include/vector.hpp> struct print_impl{ template<typename T> void operator ()(const T& rhs) const{</typename></boost/fusion/include/vector.hpp></string>…

待ち処理 続き

前回の記事を書いた後に、 「ミリ秒未満の端数分だけ、while ループで待ち処理すればいいんじゃね?」 と、思い改良しました。 使い勝手は前回と変わらず。 #include <boost/chrono.hpp> #include <boost/chrono/timer.hpp> #include <boost/utility/enable_if.hpp> #include <Windows.h> #include "sleep.hpp" #include <iostream> int main(){ using kmt_</iostream></windows.h></boost/utility/enable_if.hpp></boost/chrono/timer.hpp></boost/chrono.hpp>…

待ち処理

WINAPI の Sleep() に chrono::duration で定義されている単位で渡したかったのでラップしました。 ついでにミリ秒未満なら while ループで待ち処理も実装。 #include <boost/chrono.hpp> #include <boost/chrono/timer.hpp> #include <boost/utility/enable_if.hpp> #include <Windows.h> #include "sleep.hpp" int main(){ using kmt_ex::sleep</windows.h></boost/utility/enable_if.hpp></boost/chrono/timer.hpp></boost/chrono.hpp>…