Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81294 - trunk/libs/conversion
From: antoshkka_at_[hidden]
Date: 2012-11-11 03:59:37


Author: apolukhin
Date: 2012-11-11 03:59:36 EST (Sun, 11 Nov 2012)
New Revision: 81294
URL: http://svn.boost.org/trac/boost/changeset/81294

Log:
Simplify `test_getting_pointer_to_function` to don't deal with compilers bugs and just test that getting pointer to lexical_cast<T1, T2> is not ambiguous
Text files modified:
   trunk/libs/conversion/lexical_cast_test.cpp | 20 ++++++++++++--------
   1 files changed, 12 insertions(+), 8 deletions(-)

Modified: trunk/libs/conversion/lexical_cast_test.cpp
==============================================================================
--- trunk/libs/conversion/lexical_cast_test.cpp (original)
+++ trunk/libs/conversion/lexical_cast_test.cpp 2012-11-11 03:59:36 EST (Sun, 11 Nov 2012)
@@ -607,17 +607,21 @@
 }
 #endif
 
-template <class To, class From, class Func>
-To try_cast_by_ptr(const From& from, Func f) {
- return f(from);
-};
-
 void test_getting_pointer_to_function()
 {
     // Just checking that &lexical_cast<To, From> is not ambiguous
- BOOST_CHECK_EQUAL(100, try_cast_by_ptr<int>("100", &boost::lexical_cast<int, const char[4]>));
- BOOST_CHECK_EQUAL(100, try_cast_by_ptr<int>("100", &boost::lexical_cast<int, std::string>));
- BOOST_CHECK_EQUAL(std::string("100"), try_cast_by_ptr<std::string>(100, &boost::lexical_cast<std::string, int>));
+ typedef char char_arr[4];
+ typedef int(*f1)(const char_arr&);
+ f1 p1 = &boost::lexical_cast<int, char_arr>;
+ BOOST_CHECK(p1);
+
+ typedef int(*f2)(const std::string&);
+ f2 p2 = &boost::lexical_cast<int, std::string>;
+ BOOST_CHECK(p2);
+
+ typedef std::string(*f3)(const int&);
+ f3 p3 = &boost::lexical_cast<std::string, int>;
+ BOOST_CHECK(p3);
 }
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk