Home > Back-end >  C class template, help it will be due the day after tomorrow
C class template, help it will be due the day after tomorrow

Time:10-14

Wrote, wrote more than a week, run through, however, this is difficult, hope to pass the bosses help me
Ladies and gentlemen, it's time to show their own strength, I didn't, I excused

CodePudding user response:

?????????????? How to do, not

CodePudding user response:

You this is suitable for baidu, STL source code

CodePudding user response:

[code=cSkip to content
According to the lot?
Enterprise
Explore
Marketplace
Pricing
Search

Sign in
Sign-up
SteveLauwh

SGI - STL
26540290
Code Issues 2 Pull requests 0 Actions Projects 0 Security Insights
All your code in one place,
Making top service it easy to scale back on context switching. Read rendered documentation, see the history of any file, and word with contributors on projects across indicates dead simple.

See pricing for teams and enterprises,
SGI - the STL/SGI - STL V3.3/stl_vector h
@ steveLauwh steveLauwh commit SGI - STL V3.3
A0300a2 on 20 Jul 2017
869 lines (766 sloc) 27.9 KB

/*
*
* Copyright (c) 1994
* hewlett-packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in the supporting documentation. Hewlett-packard Company top service no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied giant.
*
*
* Copyright (c) 1996
* Silicon Graphics Computer Systems, Inc.,
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in the supporting documentation. The Silicon Graphics top service no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied giant.
*/

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

# # ifndef __SGI_STL_INTERNAL_VECTOR_H
# define __SGI_STL_INTERNAL_VECTOR_H

#include

__STL_BEGIN_NAMESPACE

# if defined (__sgi) & amp; & ! Defined (__GNUC__) & amp; & (_MIPS_SIM!=_MIPS_SIM_ABI32)
# pragma set woff 1174
# pragma set woff 1375
# endif

//The vector base class serves two purposes. First, its constructor
//and destructor the allocate (but don 't the initialize) storage. This top service
//exception safety easier. Second, the base class encapsulates all of
//the differences between SGI - style allocators and standard - conforming
//allocators.

# ifdef __STL_USE_STD_ALLOCATORS

//the Base class for ordinary allocators.
The template & lt; The class _Tp, class _Allocator, bool _IsStatic & gt;
The class _Vector_alloc_base {
Public:
Typedef typename _Alloc_traits & lt; The _Tp, _Allocator & gt; : : allocator_type
Allocator_type;
Const allocator_type get_allocator () {return _M_data_allocator; }

_Vector_alloc_base (const allocator_type & amp; __a)
: _M_data_allocator (__a), _M_start (0), _M_finish (0), _M_end_of_storage (0)
{}

Protected:
Allocator_type _M_data_allocator;
The _Tp * _M_start;
The _Tp * _M_finish;
The _Tp * _M_end_of_storage;

The _Tp * _M_allocate (size_t __n)
{return _M_data_allocator. The allocate (__n); }
Void _M_deallocate (_Tp * __p, size_t __n)
{if (__p) _M_data_allocator. Deallocate (__p __n); }
};

//Specialization for allocators that have the property that we don 't
//later have to store the an allocator object.
The template & lt; The class _Tp, class _Allocator & gt;
The class _Vector_alloc_base & lt; The _Tp, _Allocator true> {
Public:
Typedef typename _Alloc_traits & lt; The _Tp, _Allocator & gt; : : allocator_type
Allocator_type;
Const allocator_type get_allocator () {return allocator_type (); }

_Vector_alloc_base (const allocator_type & amp;)
: _M_start (0), _M_finish (0), _M_end_of_storage (0)
{}

Protected:
The _Tp * _M_start;
The _Tp * _M_finish;
The _Tp * _M_end_of_storage;

Typedef typename _Alloc_traits & lt; The _Tp, _Allocator & gt; : : _Alloc_type _Alloc_type;
The _Tp * _M_allocate (size_t __n)
{return _Alloc_type: : the allocate (__n); }
Void _M_deallocate (_Tp * __p, size_t __n)
{_Alloc_type: : deallocate (__p __n); }
};

The template & lt; The class _Tp, class _Alloc & gt;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related