2013-04-16 20:47:10 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
2012-05-21 11:12:37 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-07-01 00:19:42 +00:00
|
|
|
|
2013-06-20 00:59:09 +00:00
|
|
|
#ifndef js_Vector_h
|
|
|
|
#define js_Vector_h
|
2009-07-01 00:19:42 +00:00
|
|
|
|
2013-07-09 23:33:29 +00:00
|
|
|
#include "mozilla/Vector.h"
|
2009-08-08 03:09:11 +00:00
|
|
|
|
2010-08-02 14:44:24 +00:00
|
|
|
/* Silence dire "bugs in previous versions of MSVC have been fixed" warnings */
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(push)
|
|
|
|
#pragma warning(disable:4345)
|
|
|
|
#endif
|
|
|
|
|
2009-09-02 01:46:19 +00:00
|
|
|
namespace js {
|
2009-07-01 00:19:42 +00:00
|
|
|
|
2012-01-02 22:34:25 +00:00
|
|
|
class TempAllocPolicy;
|
|
|
|
|
2015-07-13 19:42:52 +00:00
|
|
|
namespace detail {
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
struct TypeIsGCThing : mozilla::FalseType
|
|
|
|
{};
|
|
|
|
|
|
|
|
// Uncomment this once we actually can assert it:
|
|
|
|
//template <>
|
|
|
|
//struct TypeIsGCThing<JS::Value> : mozilla::TrueType
|
|
|
|
//{};
|
|
|
|
|
|
|
|
} // namespace detail
|
2013-07-09 23:33:29 +00:00
|
|
|
|
|
|
|
template <typename T,
|
2012-01-02 22:34:25 +00:00
|
|
|
size_t MinInlineCapacity = 0,
|
2015-07-13 19:42:52 +00:00
|
|
|
class AllocPolicy = TempAllocPolicy
|
|
|
|
// 1800 is MSVC2013. Optimistically assume MSVC2015 (1900) is fixed.
|
|
|
|
// If you're porting to MSVC2015 and this doesn't work, extend the
|
|
|
|
// condition to encompass that additional version (but *do* keep the
|
|
|
|
// version-check so we know when MSVC's fixed).
|
|
|
|
#if !defined(_MSC_VER) || (1800 <= _MSC_VER && _MSC_VER <= 1800)
|
|
|
|
// Don't use this with JS::Value! Use JS::AutoValueVector instead.
|
|
|
|
, typename = typename mozilla::EnableIf<!detail::TypeIsGCThing<T>::value>::Type
|
|
|
|
#endif
|
|
|
|
>
|
|
|
|
using Vector = mozilla::Vector<T, MinInlineCapacity, AllocPolicy>;
|
2009-07-01 00:19:42 +00:00
|
|
|
|
2013-07-09 23:33:29 +00:00
|
|
|
} // namespace js
|
2010-08-02 14:44:24 +00:00
|
|
|
|
2013-06-20 00:59:09 +00:00
|
|
|
#endif /* js_Vector_h */
|