Ticket #5570: string_generator.patch
File string_generator.patch, 1.4 KB (added by , 11 years ago) |
---|
-
N:\_tmp\string_generator.hpp
old new 6 6 // http://www.boost.org/LICENSE_1_0.txt) 7 7 8 8 #ifndef BOOST_UUID_STRING_GENERATOR_HPP 9 9 #define BOOST_UUID_STRING_GENERATOR_HPP 10 10 11 11 #include <boost/uuid/uuid.hpp> 12 #include <boost/throw_exception.hpp> 12 13 #include <string> 13 14 #include <cstring> // for strlen, wcslen 14 15 #include <iterator> 15 16 #include <algorithm> // for find 16 17 #include <stdexcept> 17 18 … … 38 39 struct string_generator { 39 40 typedef uuid result_type; 40 41 41 42 template <typename ch, typename char_traits, typename alloc> 42 43 uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const { 43 44 return operator()(s.begin(), s.end()); 44 } ;45 } 45 46 46 47 uuid operator()(char const*const s) const { 47 48 return operator()(s, s+std::strlen(s)); 48 49 } 49 50 50 51 uuid operator()(wchar_t const*const s) const { … … 171 172 } else { 172 173 throw_invalid(); 173 174 } 174 175 } 175 176 176 177 void throw_invalid() const { 177 throw std::runtime_error("invalid uuid string"); 178 // FIXME: maybe this should use BOOST_THROW_EXCEPTION() instead? 179 throw_exception(std::runtime_error("invalid uuid string")); 178 180 } 179 181 }; 180 182 181 183 }} // namespace boost::uuids 182 184 183 185 #endif //BOOST_UUID_STRING_GENERATOR_HPP 184 186