compat.hpp 853 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Luwra
  2. * Minimal-overhead Lua wrapper for C++
  3. *
  4. * Copyright (C) 2015, Ole Krüger <ole@vprsm.de>
  5. */
  6. #ifndef LUWRA_COMPAT_H_
  7. #define LUWRA_COMPAT_H_
  8. #include "common.hpp"
  9. LUWRA_NS_BEGIN
  10. namespace internal {
  11. template <size_t... Is>
  12. struct IndexSequence {};
  13. template <size_t I, size_t... Is>
  14. struct MakeIndexSequenceImpl {
  15. using type = typename MakeIndexSequenceImpl<I - 1, I - 1, Is...>::type;
  16. };
  17. template <size_t... Is>
  18. struct MakeIndexSequenceImpl<0, Is...> {
  19. using type = IndexSequence<Is...>;
  20. };
  21. template <size_t I>
  22. using MakeIndexSequence = typename MakeIndexSequenceImpl<I>::type;
  23. }
  24. LUWRA_NS_END
  25. // LUA_OK does not exist in Lua 5.1 and earlier
  26. #ifndef LUA_OK
  27. #define LUA_OK 0
  28. #endif
  29. // Because VS C++
  30. #ifdef _MSC_VER
  31. #define __LUWRA_NS_RESOLVE(a, b) a::##b
  32. #else
  33. #define __LUWRA_NS_RESOLVE(a, b) a::b
  34. #endif
  35. #endif