boost_no_partial_spec.ipp 994 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // (C) Copyright John Maddock 2001.
  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)
  5. // See http://www.boost.org/libs/config for most recent version.
  6. // MACRO: BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  7. // TITLE: partial specialisation
  8. // DESCRIPTION: Class template partial specialization
  9. // (14.5.4 [temp.class.spec]) not supported.
  10. namespace boost_no_template_partial_specialization{
  11. template <class T>
  12. struct partial1
  13. {
  14. typedef T& type;
  15. };
  16. template <class T>
  17. struct partial1<T&>
  18. {
  19. typedef T& type;
  20. };
  21. template <class T, bool b>
  22. struct partial2
  23. {
  24. typedef T& type;
  25. };
  26. template <class T>
  27. struct partial2<T,true>
  28. {
  29. typedef T type;
  30. };
  31. int test()
  32. {
  33. int i = 0;
  34. partial1<int&>::type p1 = i;
  35. partial2<int&,true>::type p2 = i;
  36. (void)p1;
  37. (void)p2;
  38. (void)i;
  39. return 0;
  40. }
  41. }