ADC Home > Reference Library > Reference > Darwin > Miscellaneous User Space API Reference

 


stl_vector.h

Includes:

Introduction

This is an internal header file, included by other library headers. You should not attempt to use it directly.



Structs and Unions


_Vector_base


template<typename _Tp, typename _Alloc> struct _Vector_base { 
    struct _Vector_impl : public _Alloc { 
        _Tp* _M_start; 
        _Tp* _M_finish; 
        _Tp* _M_end_of_storage; 
        _Vector_impl(
            _Alloc const& __a) : _Alloc(
            __a), _M_start(0), _M_finish(0), _M_end_of_storage(0) {
                } 
        };  
    public: typedef _Alloc allocator_type;  
    allocator_type get_allocator() const {
        return *static_cast<const _Alloc*>(
            &this->_M_impl);
        }  _Vector_base(
        const allocator_type& __a) : _M_impl(__a) {
        }  _Vector_base(
        size_t __n,
        const allocator_type& __a) : _M_impl(__a) { 
        this->_M_impl._M_start = this->_M_allocate(
            __n); 
        this->_M_impl._M_finish = this->_M_impl._M_start; 
        this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n; 
        }  ~_Vector_base() {
        _M_deallocate(
            this->_M_impl._M_start,
            this->_M_impl._M_end_of_storage - this->_M_impl._M_start);
        }  public: _Vector_impl _M_impl;  
    _Tp* _M_allocate(size_t __n) {
        return _M_impl.allocate(
            __n);
        }  void _M_deallocate(_Tp* __p, size_t __n) { 
        if (
            __p) _M_impl.deallocate(
            __p,
            __n); 
        } 
};  
Discussion

@if maint See bits/stl_deque.h's _Deque_base for an explanation. @endif


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.
Last Updated: 2006-06-20