removeref.h 1013 B

123456789101112131415161718192021222324252627282930313233343536
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/meta/removeref.h
  3. // Purpose: Allows to remove a reference from a type.
  4. // Author: Vadim Zeitlin
  5. // Created: 2012-10-21
  6. // Copyright: (c) 2012 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_META_REMOVEREF_H_
  10. #define _WX_META_REMOVEREF_H_
  11. // wxRemoveRef<> is similar to C++11 std::remove_reference<> but works with all
  12. // compilers (but, to compensate for this, doesn't work with rvalue references).
  13. // Except that it doesn't work with VC++ 6 as there doesn't seem to be any way
  14. // to partially specialize a template for references with it.
  15. #ifndef __VISUALC6__
  16. template <typename T>
  17. struct wxRemoveRef
  18. {
  19. typedef T type;
  20. };
  21. template <typename T>
  22. struct wxRemoveRef<T&>
  23. {
  24. typedef T type;
  25. };
  26. #define wxHAS_REMOVEREF
  27. #endif // !__VISUALC6__
  28. #endif // _WX_META_REMOVEREF_H_