epoc32/include/stdapis/stlport/stl/_tempbuf.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_tempbuf.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,165 +0,0 @@
     1.4 -/*
     1.5 - *
     1.6 - * Copyright (c) 1994
     1.7 - * Hewlett-Packard Company
     1.8 - *
     1.9 - * Copyright (c) 1996,1997
    1.10 - * Silicon Graphics Computer Systems, Inc.
    1.11 - *
    1.12 - * Copyright (c) 1997
    1.13 - * Moscow Center for SPARC Technology
    1.14 - *
    1.15 - * Copyright (c) 1999 
    1.16 - * Boris Fomitchev
    1.17 - *
    1.18 - * This material is provided "as is", with absolutely no warranty expressed
    1.19 - * or implied. Any use is at your own risk.
    1.20 - *
    1.21 - * Permission to use or copy this software for any purpose is hereby granted 
    1.22 - * without fee, provided the above notices are retained on all copies.
    1.23 - * Permission to modify the code and to distribute modified code is granted,
    1.24 - * provided the above notices are retained, and a notice that the code was
    1.25 - * modified is included with the above copyright notice.
    1.26 - *
    1.27 - */
    1.28 -
    1.29 -/* NOTE: This is an internal header file, included by other STL headers.
    1.30 - *   You should not attempt to use it directly.
    1.31 - */
    1.32 -
    1.33 -#ifndef _STLP_INTERNAL_TEMPBUF_H
    1.34 -#define _STLP_INTERNAL_TEMPBUF_H
    1.35 -
    1.36 -# ifndef _STLP_CLIMITS
    1.37 -#  include <climits>
    1.38 -# endif
    1.39 -# ifndef _STLP_CSTDLIB
    1.40 -#  include <cstdlib>
    1.41 -# endif
    1.42 -# ifndef _STLP_INTERNAL_UNINITIALIZED_H
    1.43 -#  include <stl/_uninitialized.h>
    1.44 -# endif
    1.45 -
    1.46 -_STLP_BEGIN_NAMESPACE
    1.47 -
    1.48 -template <class _Tp>
    1.49 -pair<_Tp*, ptrdiff_t>  _STLP_CALL
    1.50 -__get_temporary_buffer(ptrdiff_t __len, _Tp*);
    1.51 -
    1.52 -#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS
    1.53 -
    1.54 -template <class _Tp>
    1.55 -inline pair<_Tp*, ptrdiff_t>  _STLP_CALL get_temporary_buffer(ptrdiff_t __len) {
    1.56 -  return __get_temporary_buffer(__len, (_Tp*) 0);
    1.57 -}
    1.58 -
    1.59 -# if ! defined(_STLP_NO_EXTENSIONS)
    1.60 -// This overload is not required by the standard; it is an extension.
    1.61 -// It is supported for backward compatibility with the HP STL, and
    1.62 -// because not all compilers support the language feature (explicit
    1.63 -// function template arguments) that is required for the standard
    1.64 -// version of get_temporary_buffer.
    1.65 -template <class _Tp>
    1.66 -inline pair<_Tp*, ptrdiff_t>  _STLP_CALL
    1.67 -get_temporary_buffer(ptrdiff_t __len, _Tp*) {
    1.68 -  return __get_temporary_buffer(__len, (_Tp*) 0);
    1.69 -}
    1.70 -# endif
    1.71 -#endif
    1.72 -
    1.73 -template <class _Tp>
    1.74 -inline void  _STLP_CALL return_temporary_buffer(_Tp* __p) {
    1.75 -// SunPro brain damage
    1.76 -  free((char*)__p);
    1.77 -}
    1.78 -
    1.79 -template <class _ForwardIterator, class _Tp>
    1.80 -class _Temporary_buffer {
    1.81 -private:
    1.82 -  ptrdiff_t  _M_original_len;
    1.83 -  ptrdiff_t  _M_len;
    1.84 -  _Tp*       _M_buffer;
    1.85 -
    1.86 -  void _M_allocate_buffer() {
    1.87 -    _M_original_len = _M_len;
    1.88 -    _M_buffer = 0;
    1.89 -
    1.90 -    if (_M_len > (ptrdiff_t)(INT_MAX / sizeof(_Tp)))
    1.91 -      _M_len = INT_MAX / sizeof(_Tp);
    1.92 -
    1.93 -    while (_M_len > 0) {
    1.94 -      _M_buffer = (_Tp*) malloc(_M_len * sizeof(_Tp));
    1.95 -      if (_M_buffer)
    1.96 -        break;
    1.97 -      _M_len /= 2;
    1.98 -    }
    1.99 -  }
   1.100 -
   1.101 -  void _M_initialize_buffer(const _Tp&, const __true_type&) {}
   1.102 -  void _M_initialize_buffer(const _Tp& val, const __false_type&) {
   1.103 -    uninitialized_fill_n(_M_buffer, _M_len, val);
   1.104 -  }
   1.105 -
   1.106 -public:
   1.107 -  ptrdiff_t size() const { return _M_len; }
   1.108 -  ptrdiff_t requested_size() const { return _M_original_len; }
   1.109 -  _Tp* begin() { return _M_buffer; }
   1.110 -  _Tp* end() { return _M_buffer + _M_len; }
   1.111 -
   1.112 -  _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last) {
   1.113 -    // Workaround for a __type_traits bug in the pre-7.3 compiler.
   1.114 -#   if defined(__sgi) && !defined(__GNUC__) && _COMPILER_VERSION < 730
   1.115 -    typedef typename __type_traits<_Tp>::is_POD_type _Trivial;
   1.116 -#   else
   1.117 -     typedef typename __type_traits<_Tp>::has_trivial_default_constructor  _Trivial;
   1.118 -#   endif
   1.119 -    _STLP_TRY {
   1.120 -      _M_len = distance(__first, __last);
   1.121 -      _M_allocate_buffer();
   1.122 -      if (_M_len > 0)
   1.123 -        _M_initialize_buffer(*__first, _Trivial());
   1.124 -    }
   1.125 -    _STLP_UNWIND(free(_M_buffer); _M_buffer = 0; _M_len = 0);
   1.126 -  }
   1.127 - 
   1.128 -  ~_Temporary_buffer() {  
   1.129 -    _STLP_STD::_Destroy(_M_buffer, _M_buffer + _M_len);
   1.130 -    free(_M_buffer);
   1.131 -  }
   1.132 -
   1.133 -private:
   1.134 -  // Disable copy constructor and assignment operator.
   1.135 -  _Temporary_buffer(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
   1.136 -  void operator=(const _Temporary_buffer<_ForwardIterator, _Tp>&) {}
   1.137 -};
   1.138 -
   1.139 -# ifndef _STLP_NO_EXTENSIONS
   1.140 -
   1.141 -// Class temporary_buffer is not part of the standard.  It is an extension.
   1.142 -
   1.143 -template <class _ForwardIterator, 
   1.144 -          class _Tp 
   1.145 -#ifdef _STLP_CLASS_PARTIAL_SPECIALIZATION
   1.146 -                    = typename iterator_traits<_ForwardIterator>::value_type
   1.147 -#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */
   1.148 -         >
   1.149 -struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
   1.150 -{
   1.151 -  temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
   1.152 -    : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) {}
   1.153 -  ~temporary_buffer() {}
   1.154 -};
   1.155 -
   1.156 -# endif /* _STLP_NO_EXTENSIONS */
   1.157 -    
   1.158 -_STLP_END_NAMESPACE
   1.159 -
   1.160 -# ifndef _STLP_LINK_TIME_INSTANTIATION
   1.161 -#  include <stl/_tempbuf.c>
   1.162 -# endif
   1.163 -
   1.164 -#endif /* _STLP_INTERNAL_TEMPBUF_H */
   1.165 -
   1.166 -// Local Variables:
   1.167 -// mode:C++
   1.168 -// End: