
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Thorsten Ottosen
Do you know how to make the test run for only the relevant compilers?
I've not found it yet, either; maybe Aleksey can help. _However_: When you have a look at numeric/ublas, you will see that test7 is only executed on some few compilers (no idea, why). Of course, this could also be a defect :)
| | template <class T> struct wrap {}; | | // this one should disabled because it's not allowed to return an array: | template< typename T > T(* is_array_tester1(wrap<T>) )(wrap<T>);
What does the line above mean in plain English :-)
It's only the half solution but it was enough to show the SFINAE problem. The complete code looks like this: template< typename T > T(* is_array_tester1(wrap<T>) )(wrap<T>); char BOOST_TT_DECL is_array_tester1(...); template< typename T> no_type is_array_tester2(T(*)(wrap<T>)); yes_type BOOST_TT_DECL is_array_tester2(...); template< typename T > struct is_array_impl { BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::detail::is_array_tester2( ::boost::detail::is_array_tester1( ::boost::type_traits::wrap<T>() ) )) == 1 ); }; Here, if a function returning T can be instantiated (is_array_tester1), T cannot be an array. This is tested by is_array_tester2.
And why is is_array not defined as
template< class T, int sz > true_type is_array( const T (&array)[sz] ); template< class T, int sz > true_type is_array( T (&array)[sz] ); no_type is_array( ... );
This was my first question, too, but the answer probably can only give any of the authors. It could be: "does this work with open arrays?" Stefan