Eliminate boost::lexical_cast usage completely #39

This commit is contained in:
Jason Turner
2012-06-03 09:20:15 -06:00
parent 832df7f9e8
commit d2aba2ef56
5 changed files with 28 additions and 20 deletions

View File

@@ -93,27 +93,34 @@ namespace chaiscript
/**
* to_string function for internal use. Uses ostream operator<<
*/
* to_string function for internal use. Uses ostream operator<<
*/
template<typename Input>
std::string to_string(Input i)
{
return boost::lexical_cast<std::string>(i);
}
std::string to_string(Input i)
{
std::stringstream ss;
ss << i;
return ss.str();
}
/**
* Internal function for converting from a string to a value
* uses ostream operator >> to perform the conversion
*/
* Internal function for converting from a string to a value
* uses ostream operator >> to perform the conversion
*/
template<typename Input>
Input parse_string(const std::string &i)
{
return boost::lexical_cast<Input>(i);
}
Input parse_string(const std::string &i)
{
std::stringstream ss(i);
Input t;
ss >> t;
return t;
}
/**
* Add all common functions for a POD type. All operators, and
* common conversions

View File

@@ -12,8 +12,6 @@
#include <map>
#include <set>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/tuple/tuple.hpp>
#include <stdexcept>
#include <vector>
#include <iostream>

View File

@@ -21,7 +21,6 @@
#include <string>
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include <boost/lexical_cast.hpp>
#include <stdexcept>
#include <vector>