Sha256: 9051bc749f40dcb243640553e3ef14437682f2df126c0e2ae569de7f0314360b

Contents?: true

Size: 1.56 KB

Versions: 135

Compression:

Stored size: 1.56 KB

Contents

/*
 * Copyright (c) 2005
 * Francois Dumont
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */

/* NOTE: This is an internal header file, included by other STL headers.
 *   You should not attempt to use it directly.
 */

#ifndef _STLP_CARRAY_H
#define _STLP_CARRAY_H

/* Purpose: Mimic a pur C array with the additionnal feature of
 * being able to be used with type not default constructible.
 */

#ifndef _STLP_INTERNAL_CONSTRUCT_H
#  include <stl/_construct.h>
#endif

_STLP_BEGIN_NAMESPACE

_STLP_MOVE_TO_PRIV_NAMESPACE

template <class _Tp, size_t _Nb>
struct _CArray {
  _CArray (const _Tp& __val) {
    for (size_t __i = 0; __i < _Nb; ++__i) {
      _Copy_Construct(__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp)), __val);
    }
  }

  ~_CArray() {
    _Destroy_Range(__REINTERPRET_CAST(_Tp*, _M_data + 0),
                   __REINTERPRET_CAST(_Tp*, _M_data + _Nb * sizeof(_Tp)));
  }

  _Tp& operator [] (size_t __i) {
    _STLP_ASSERT(__i < _Nb)
    return *__REINTERPRET_CAST(_Tp*, _M_data + __i * sizeof(_Tp));
  }

private:
  char _M_data[sizeof(_Tp) * _Nb];
};

_STLP_MOVE_TO_STD_NAMESPACE

_STLP_END_NAMESPACE

#endif //_STLP_CARRAY_H

Version data entries

135 entries across 135 versions & 2 rubygems

Version Path
rhodes-7.6.0 platform/shared/stlport/stlport/stl/_carray.h
rhodes-7.5.1 platform/shared/stlport/stlport/stl/_carray.h
rhodes-7.4.1 platform/shared/stlport/stlport/stl/_carray.h
rhodes-7.1.17 platform/shared/stlport/stlport/stl/_carray.h
rhodes-6.2.0 platform/shared/stlport/stlport/stl/_carray.h
rhodes-6.0.11 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.18 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.17 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.15 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.0.22 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.2 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.0.7 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.0.3 platform/shared/stlport/stlport/stl/_carray.h
rhodes-5.5.0 platform/shared/stlport/stlport/stl/_carray.h
tauplatform-1.0.3 platform/shared/stlport/stlport/stl/_carray.h
tauplatform-1.0.2 platform/shared/stlport/stlport/stl/_carray.h
tauplatform-1.0.1 platform/shared/stlport/stlport/stl/_carray.h
rhodes-3.5.1.12 platform/shared/stlport/stlport/stl/_carray.h
rhodes-3.3.5 platform/shared/stlport/stlport/stl/_carray.h
rhodes-3.4.2 platform/shared/stlport/stlport/stl/_carray.h