id summary reporter owner description type status milestone component version severity resolution keywords cc 10393 Add begin/end specialization for optional type khimru@… Fernando Cacciola "optional could be used in many places as if it was just T, but, since C++ does not apply two levels of constructions one could not use this natural looking construct for optional containers: if (opt_container) { for (auto& element : opt_container) { ... } } Simple specialization of begin()/end() functions could solve this problem: namespace std { template inline auto begin(const boost::optional& opt) -> decltype(opt.get().begin()) { return opt.get().begin(); } template inline auto begin(boost::optional& opt) -> decltype(opt.get().begin()) { return opt.get().begin(); } template inline auto end(const boost::optional& opt) -> decltype(opt.get().end()) { return opt.get().end(); } template inline auto end(boost::optional& opt) -> decltype(opt.get().end()) { return opt.get().end(); } } " Feature Requests new Boost 1.57.0 optional Boost 1.56.0 Cosmetic optional, for, begin, end