
Joel de Guzman <joel@boost-consulting.com> writes:
David Abrahams wrote:
Tobias Schwinger <tschwinger@neoscientists.org> writes:
Why not make is_sequence work reliably?
Because it's impossible. It's always going to look for some features of the type being tested that can be present even if the type is not, in fact, a sequence.
I don't see why it is impossible. MPL sequences can always specialize is_sequence<T>. is_sequence *can* work reliably 100% of the time:
template <class S> struct is_sequence : mpl::false_ {}; // default
// your specializations here
The problem isn't false negatives, it's false positives. In practice you can probably make it vanishingly unlikely that some random third-party type will pass all the default is_sequence tests, but you can never make it 100% impossible as long as: a. sequences can be arbitrary types, such as void(int,long,char) b. is_sequence<S> reporting correctly is not part of the sequence requirements -- Dave Abrahams Boost Consulting www.boost-consulting.com