1 // (C) Copyright John Maddock 2000.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org for most recent version including documentation.
11 #include <boost/static_assert.hpp>
12 #include <boost/type_traits.hpp>
14 template <class RandomAccessIterator
>
15 RandomAccessIterator
foo(RandomAccessIterator from
, RandomAccessIterator
)
17 // this template can only be used with
18 // random access iterators...
19 typedef typename
std::iterator_traits
< RandomAccessIterator
>::iterator_category cat
;
20 BOOST_STATIC_ASSERT((boost::is_convertible
<cat
*, std::random_access_iterator_tag
*>::value
));
22 // detail goes here...
26 // ensure that delayed instantiation compilers like Comeau see the failure early
27 // enough for "compile-fail" testing with the Boost.Build testing framework. (Greg Comeau)
29 std::list
<int>::iterator
30 foo(std::list
<int>::iterator
, std::list
<int>::iterator
);
36 foo(d
.begin(), d
.end()); // OK
37 foo(l
.begin(), l
.end()); // error