diff --git a/examples/demo.cpp b/examples/demo.cpp index ae14c60..04df3ee 100644 --- a/examples/demo.cpp +++ b/examples/demo.cpp @@ -2,17 +2,6 @@ #include -#include - -namespace string2type { - -template<> -int convert(const std::string &value) { - return boost::lexical_cast(value); -} - -} - struct foo : attributes { foo() { REGISTER_ATTRIBUTE(int, x); diff --git a/src/string2type.hpp b/src/string2type.hpp index 044b842..332a48c 100644 --- a/src/string2type.hpp +++ b/src/string2type.hpp @@ -16,10 +16,14 @@ #include +#include + namespace string2type { template -T convert(const std::string &value); +T convert(const std::string &value) { + return boost::lexical_cast(value); +} } diff --git a/unittest/AttributesTest.cpp b/unittest/AttributesTest.cpp index 49573eb..d8296ba 100644 --- a/unittest/AttributesTest.cpp +++ b/unittest/AttributesTest.cpp @@ -6,16 +6,6 @@ #include #include -#include - -namespace string2type { - -template<> -int convert(const std::string &value) { - return boost::lexical_cast(value); -} - -} struct test : attributes { test() : x(0) { diff --git a/unittest/String2typeTest.cpp b/unittest/String2typeTest.cpp index 880870f..459a8f8 100644 --- a/unittest/String2typeTest.cpp +++ b/unittest/String2typeTest.cpp @@ -5,23 +5,6 @@ #include -#include -#include - -namespace string2type { - -template<> -int convert(const std::string &value) { - return boost::lexical_cast(value); -} - -template<> -double convert(const std::string &value) { - return boost::lexical_cast(value); -} - -} - BOOST_AUTO_TEST_SUITE(string2type_test) BOOST_AUTO_TEST_CASE( test1 )