• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 // Copyright 2011 Daniel James.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // This tests if container forwarding is correctly disabled. If it isn't
7 // disabled it causes a compile error (which causes the test to pass).
8 // If it is disabled it tries container forwarding. If it doesn't work
9 // then there will be a compile error, indicating that it is correctly
10 // disabled. But if there isn't a compile error that indicates that
11 // container forwarding might work.
12 //
13 // Since this test only tries std::vector, it might get it wrong but I didn't
14 // want it to fail because of some incompatibility with a trickier class.
15 
16 #define BOOST_DETAIL_TEST_CONFIG_ONLY
17 #include <boost/detail/container_fwd.hpp>
18 
19 #if !defined(BOOST_DETAIL_NO_CONTAINER_FWD)
20 #error "Failing in order to pass test"
21 #else
22 #define BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD
23 
24 #undef BOOST_DETAIL_CONTAINER_FWD_HPP
25 #undef BOOST_DETAIL_TEST_CONFIG_ONLY
26 
27 #include <boost/detail/container_fwd.hpp>
28 
29 template <class T, class Allocator>
test(std::vector<T,Allocator> const &)30 void test(std::vector<T, Allocator> const&)
31 {
32 }
33 
34 #include <vector>
35 
main()36 int main ()
37 {
38     std::vector<int> x;
39     test(x);
40 }
41 
42 #endif
43 
44