added testcase as Howard suggested, breaks in g++

[SVN r1420]
This commit is contained in:
Jaakko Järvi
2003-07-09 20:28:34 +00:00
parent 96d34daff4
commit 1ac3dbad75

View File

@@ -30,6 +30,19 @@ struct container {
my_value(false) {} my_value(false) {}
}; };
// example from Howard Hinnant (tests enable_if template members of a templated class)
template <class charT>
struct xstring
{
template <class It>
xstring(It begin, It end, typename
enable_if<!is_arithmetic<It>::value>::type* = 0)
: data(end-begin) {}
int data;
};
int test_main(int, char*[]) int test_main(int, char*[])
{ {
@@ -39,6 +52,10 @@ int test_main(int, char*[])
BOOST_TEST(!container("1").my_value); BOOST_TEST(!container("1").my_value);
BOOST_TEST(!container(static_cast<void*>(0)).my_value); BOOST_TEST(!container(static_cast<void*>(0)).my_value);
char sa[] = "123456";
BOOST_TEST(xstring<char>(sa, sa+6).data == 6);
return 0; return 0;
} }