pointer_to_other.hpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED
  2. #define BOOST_POINTER_TO_OTHER_HPP_INCLUDED
  3. //
  4. // pointer_to_other.hpp
  5. //
  6. // (C) Copyright Ion Gaztanaga 2005.
  7. // Copyright (c) 2005 Peter Dimov.
  8. //
  9. // Distributed under the Boost Software License, Version 1.0.
  10. //
  11. // (See accompanying file LICENSE_1_0.txt or copy at
  12. // http://www.boost.org/LICENSE_1_0.txt)
  13. //
  14. // See http://www.boost.org/libs/smart_ptr/ for documentation.
  15. //
  16. namespace boost
  17. {
  18. // Defines the same pointer type (raw or smart) to another pointee type
  19. template<class T, class U>
  20. struct pointer_to_other;
  21. template<class T, class U,
  22. template<class> class Sp>
  23. struct pointer_to_other< Sp<T>, U >
  24. {
  25. typedef Sp<U> type;
  26. };
  27. template<class T, class T2, class U,
  28. template<class, class> class Sp>
  29. struct pointer_to_other< Sp<T, T2>, U >
  30. {
  31. typedef Sp<U, T2> type;
  32. };
  33. template<class T, class T2, class T3, class U,
  34. template<class, class, class> class Sp>
  35. struct pointer_to_other< Sp<T, T2, T3>, U >
  36. {
  37. typedef Sp<U, T2, T3> type;
  38. };
  39. template<class T, class U>
  40. struct pointer_to_other< T*, U >
  41. {
  42. typedef U* type;
  43. };
  44. } // namespace boost
  45. #endif // #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED