Vector.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. * This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef js_Vector_h
  6. #define js_Vector_h
  7. #include "mozilla/Vector.h"
  8. /* Silence dire "bugs in previous versions of MSVC have been fixed" warnings */
  9. #ifdef _MSC_VER
  10. #pragma warning(push)
  11. #pragma warning(disable:4345)
  12. #endif
  13. namespace js {
  14. class TempAllocPolicy;
  15. namespace detail {
  16. template <typename T>
  17. struct TypeIsGCThing : mozilla::FalseType
  18. {};
  19. // Uncomment this once we actually can assert it:
  20. //template <>
  21. //struct TypeIsGCThing<JS::Value> : mozilla::TrueType
  22. //{};
  23. } // namespace detail
  24. template <typename T,
  25. size_t MinInlineCapacity = 0,
  26. class AllocPolicy = TempAllocPolicy,
  27. // Don't use this with JS::Value! Use JS::AutoValueVector instead.
  28. typename = typename mozilla::EnableIf<!detail::TypeIsGCThing<T>::value>::Type
  29. >
  30. using Vector = mozilla::Vector<T, MinInlineCapacity, AllocPolicy>;
  31. } // namespace js
  32. #endif /* js_Vector_h */