From 1ac3dbad7534ba3fefbf6c92a44decf17bdb1085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20J=C3=A4rvi?= Date: Wed, 9 Jul 2003 20:28:34 +0000 Subject: [PATCH] added testcase as Howard suggested, breaks in g++ [SVN r1420] --- test/enable_if_constructors.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/enable_if_constructors.cpp b/test/enable_if_constructors.cpp index 31388c7..a87fd8d 100644 --- a/test/enable_if_constructors.cpp +++ b/test/enable_if_constructors.cpp @@ -30,6 +30,19 @@ struct container { my_value(false) {} }; +// example from Howard Hinnant (tests enable_if template members of a templated class) +template +struct xstring +{ + template + xstring(It begin, It end, typename + enable_if::value>::type* = 0) + : data(end-begin) {} + + int data; +}; + + int test_main(int, char*[]) { @@ -39,6 +52,10 @@ int test_main(int, char*[]) BOOST_TEST(!container("1").my_value); BOOST_TEST(!container(static_cast(0)).my_value); + char sa[] = "123456"; + BOOST_TEST(xstring(sa, sa+6).data == 6); + + return 0; }