{"published":"2014-05-02 14:50:12","version":"1.0","categories":["C++"],"title":"\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u521d\u671f\u5316\u304c\u30a8\u30e9\u30fc\u3092\u51fa\u529b\u3059\u308b\u5834\u5408","width":"100%","author_url":"https://blog.hatena.ne.jp/faith_and_brave/","blog_title":"Faith and Brave - C++\u3067\u904a\u307c\u3046","description":"\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u304c\u4f8b\u5916\u3092\u6295\u3052\u308b\u306e\u3067\u306f\u306a\u304f\u3001factory\u304c\u30a8\u30e9\u30fc\u3092\u8fd4\u3059\u306e\u304c\u3044\u3044\u3002 #include <iostream> #include <boost/optional.hpp> struct X { bool initialize() { return true; } }; boost::optional<X> factoryX() { X x; if (x.initialize()) { return x; } return boost::none; } int main() { boost::optional<X> x = factoryX(); } factory\u306f\u3001\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf(\u521d\u2026","author_name":"faith_and_brave","provider_name":"Hatena Blog","type":"rich","blog_url":"https://faithandbrave.hateblo.jp/","height":"190","provider_url":"https://hatena.blog","url":"https://faithandbrave.hateblo.jp/entry/2014/05/02/145012","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Ffaithandbrave.hateblo.jp%2Fentry%2F2014%2F05%2F02%2F145012\" title=\"\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u521d\u671f\u5316\u304c\u30a8\u30e9\u30fc\u3092\u51fa\u529b\u3059\u308b\u5834\u5408 - Faith and Brave - C++\u3067\u904a\u307c\u3046\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null}