Giter Site home page Giter Site logo

stl2022's Introduction

  • output_iterator_tag的理解
  • 完成stl_iterator_base.h
  • __malloc_alloc_template中对out-of-memory-handling的处理
  • 研究__STL_USE_STD_ALLOCATORS被定义时的类继承关系

STL

功能性头文件:

stl_config.h
stl_alloc.h
stl_iterator_base.h
stl_construct.h
stl_uninitialized.h

容器性头文件

stl_pair.h
stl_vector.h
...

stl_iterator_base.h

# 五种迭代器类别类
struct input_iterator_tag;
struct forward_iterator_tag : public input_iterator_tag;
struct bidirectional_iterator_tag : public forward_iterator_tag;
struct random_iterator_tag : public bidirectional_iterator_tag
struct output_iterator_tag;


# 基础迭代器模板衍生出: 5中偏特化迭代器模板
template <...> class iterator;
template <...> class input_iterator;
template <...> class forward_iterator;
template <...> class bidirectional_iterator;
template <...> class random_iterator;
template <...> class output_iterator;

# 迭代器萃取器, 萃取出几种特性
template <...> class iterator_traits;

template <typename _Iter> iterator_traits::iterator_category;
template <typename _Iter> iterator_traits::value_type;
template <typename _Iter> iterator_traits::difference_type;
template <typename _Iter> iterator_traits::pointer_type;
template <typename _Iter> iterator_traits::reference_type;

# 函数advance(自增)和distance(距离)
template <typename _Iter> typename iterator_traits<_Iter>::difference_type \
    distance(_Iter first_, _Iter last_);

template <typename _Iter> void advance(_Iter iter_);

stl_alloc.h

两种配置器: simple_alloc和malloc_alloc

typedef simple_alloc simple_alloc;

typedef malloc_alloc_template<0> malloc_alloc;
typedef malloc_alloc alloc;
typedef malloc_alloc single_client_alloc;

stl_construct.h

template <typename _T1, typename _T2> construct(_T1*, _T2);
template <typename _T1> construct(_T1*);
template <typename _T1> destroy(_T1*);
template <typename _ForwardIterator> destroy(_ForwardIterator first_, _ForwardIterator last_);

stl2022's People

Contributors

haomingju avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.