usage_fail.cpp 595 B

123456789101112131415161718192021222324
  1. // Copyright David Abrahams 2006. Distributed under the Boost
  2. // Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/concept/usage.hpp>
  5. #include <boost/core/ignore_unused.hpp>
  6. template <class T>
  7. struct StringInitializable
  8. {
  9. typedef int associated;
  10. BOOST_CONCEPT_USAGE(StringInitializable)
  11. {
  12. T x = "foo";
  13. boost::ignore_unused(x);
  14. }
  15. };
  16. // Test that accessing an associated type will actually exercise usage
  17. // requirements
  18. typedef StringInitializable<int>::associated tee;