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; }