Ticket #5570: string_generator.patch

File string_generator.patch, 1.4 KB (added by olim@…, 11 years ago)
  • N:\_tmp\string_generator.hpp

    old new  
    66// http://www.boost.org/LICENSE_1_0.txt)
    77
    88#ifndef BOOST_UUID_STRING_GENERATOR_HPP
    99#define BOOST_UUID_STRING_GENERATOR_HPP
    1010
    1111#include <boost/uuid/uuid.hpp>
     12#include <boost/throw_exception.hpp>
    1213#include <string>
    1314#include <cstring> // for strlen, wcslen
    1415#include <iterator>
    1516#include <algorithm> // for find
    1617#include <stdexcept>
    1718
     
    3839struct string_generator {
    3940    typedef uuid result_type;
    4041   
    4142    template <typename ch, typename char_traits, typename alloc>
    4243    uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const {
    4344        return operator()(s.begin(), s.end());
    44     };
     45    }
    4546
    4647    uuid operator()(char const*const s) const {
    4748        return operator()(s, s+std::strlen(s));
    4849    }
    4950
    5051    uuid operator()(wchar_t const*const s) const {
     
    171172        } else {
    172173            throw_invalid();
    173174        }
    174175    }
    175176   
    176177    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"));
    178180    }
    179181};
    180182
    181183}} // namespace boost::uuids
    182184
    183185#endif //BOOST_UUID_STRING_GENERATOR_HPP
    184186