author Tom Tromey <>
Thu, 14 Jul 2016 10:16:42 -0600
changeset 306106 3ec6380fca8207fa199693206a3ca24975bf9833
parent 304308 96875d7ae6f2f4cb0f56cd872eaae90345933563
permissions -rw-r--r--
Bug 1286877 - do not set c-basic-offset for python-mode; r=gps This removes the unnecessary setting of c-basic-offset from all python-mode files. This was automatically generated using perl -pi -e 's/; *c-basic-offset: *[0-9]+//' ... on the affected files. The bulk of these files are files but there a few others as well. MozReview-Commit-ID: 2pPf3DEiZqx

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 */

/* A polyfill for std::initializer_list if it doesn't exist */

#ifndef mozilla_InitializerList_h
#define mozilla_InitializerList_h

#include <mozilla/Compiler.h>
#include <mozilla/Attributes.h>
#elif MOZ_USING_LIBSTDCXX && __GLIBCXX__ >= 20090421 // GCC 4.4.0
#elif _MSC_VER
#elif defined(MOZ_USING_STLPORT)
#  error "Unknown standard library situation"

#  include <initializer_list>
/* Normally we would put things in mozilla:: however, std::initializer_list is a
 * magic name used by the compiler and so we need to name it that way.
namespace std

template<class T>
class initializer_list
    /* This matches the representation used by GCC and Clang which
     * are the only compilers we need to polyfill */
    const T* mBegin;
    size_t   mSize;

    /* This constructor is called directly by the compiler */
    initializer_list(const T* aBegin, size_t aSize)
      : mBegin(aBegin)
      , mSize(aSize) { }

    constexpr initializer_list() : mBegin(nullptr), mSize(0) {}

    typedef T value_type;
    typedef const T& reference;
    typedef const T& const_reference;
    typedef size_t size_type;
    typedef const T* iterator;
    typedef const T* const_iterator;

    size_t size() const { return mSize; }
    const T* begin() const { return mBegin; }
    const T* end() const { return mBegin + mSize; }

#endif /* mozilla_InitializerList_h */