fork download
  1. #include <iostream>
  2. static const std::size_t offset_type_alignment = 0;
  3.  
  4. template<class T, class U>
  5. struct pointer_to_other;
  6.  
  7. template<class T, class U, template<class> class Sp>
  8. struct pointer_to_other< Sp<T>, U >
  9. {
  10. typedef Sp<U> type;
  11. };
  12.  
  13. template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
  14. class offset_ptr
  15. {
  16. };
  17. template <class T, class DifferenceType = std::ptrdiff_t, class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
  18. class offset_ptr;
  19.  
  20.  
  21. template<class T, class T2, class T3, std::size_t A, class U>
  22. struct pointer_to_other<offset_ptr<T, T2, T3, A>, U >
  23. {
  24. typedef offset_ptr<U, T2, T3, A> type;
  25. };
  26.  
  27.  
  28. template<class VoidPointer>
  29. class message_queue_t
  30. {
  31. typedef VoidPointer void_pointer;
  32. typedef typename pointer_to_other<void_pointer, char>::type char_ptr;
  33. };
  34.  
  35. int main()
  36. {
  37. message_queue_t< offset_ptr<void, std::ptrdiff_t, std::size_t, offset_type_alignment> > test;
  38.  
  39.  
  40. }
Success #stdin #stdout 0.01s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty