mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
try fixing issue #482
This commit is contained in:
parent
c54f7c81c4
commit
2373b94d3e
2 changed files with 28 additions and 11 deletions
14
util.h
14
util.h
|
@ -5,11 +5,25 @@
|
|||
#include <string>
|
||||
#include <iostream>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
|
||||
/**
|
||||
wrapper arround boost::lexical_cast that "never" fails
|
||||
*/
|
||||
template <typename T>
|
||||
T lexical_cast(const std::string & str, const T fallback) {
|
||||
try {
|
||||
return boost::lexical_cast<T>(str);
|
||||
} catch ( ... ) {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
namespace http
|
||||
{
|
||||
// in (lower case)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue