ゴミ箱
convert.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <optional>
4 
5 #include <boost/lexical_cast.hpp>
6 
7 namespace utils {
16  template <typename Target, typename Source>
17  inline std::optional<Target> convert(const Source &arg)
18  {
19  Target result;
20 
21  return boost::conversion::try_lexical_convert(arg, result) ? std::make_optional(result) : std::nullopt;
22  }
23 }
std::optional< Target > convert(const Source &arg)
Definition: convert.hpp:17
Definition: convert.hpp:7