2015-01-29から1日間の記事一覧

boost::optionalのパターンマッチ as 文

C++

boost::optionalを0 or 1要素のRangeと見なす。 #include <memory> #include <boost/optional.hpp> namespace boost { template <class T> T* begin(boost::optional<T>& opt) noexcept { return opt.is_initialized() ? std::addressof(opt.get()) : nullptr; } template <class T> T* end(boost::optional<T>& o</t></class></t></class></boost/optional.hpp></memory>…