Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/network/uri/uri.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <iterator>
#include <algorithm>
#include <functional>
#include <boost/lexical_cast.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/optional.hpp>
Expand Down Expand Up @@ -266,10 +267,9 @@ namespace network {
boost::optional<IntT> port(typename std::is_integral<IntT>::type * = 0) const {
if (auto p = port()) {
try {
return static_cast<IntT>(
std::stoi(string_type(std::begin(*p), std::end(*p))));
return boost::lexical_cast<IntT>(string_type(std::begin(*p), std::end(*p)));
}
catch (std::invalid_argument &) {
catch (boost::bad_lexical_cast &) {
return boost::optional<IntT>();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/network/uri/uri_builder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace network {
struct port_converter<T, typename std::enable_if<std::is_integral<typename std::decay<T>::type>::value>::type> {

uri::string_type operator () (std::uint16_t port) const {
return std::to_string(port);
return boost::lexical_cast<uri::string_type>(port);
}

};
Expand Down