#pragma once
#include<assert.h>
template <class _Ty>
class list
{
public:
struct _Node;
typedef _Node* _Nodeptr;
struct _Node {
_Ty value;
_Nodeptr prev;
_Nodeptr next;
};
typedef _Ty value_type;
typedef _Ty* pointer_type;
typedef _Ty& reference_type;
typedef const _Ty& const_reference_type;
typedef const _Ty* const_pointer_type;
typedef int difference_type;
private:
_Nodeptr _head;
size_t _size;
public:
explicit list():_head(_Buynode()),_size(0) {
}
void push_back(const _Ty value) {
_Nodeptr _s = _Buynode(_head,_head->prev);
_s->value = value;
_head->prev->next = _s;
_head->prev = _s;
_size++;
}
void push_front(const _Ty value) {
}
void pop_back() {
}
protected:
_Nodeptr _Buynode(_Nodeptr _Narg=0,_Nodeptr _Parg=0) {
_Nodeptr _s = (_Nodeptr)malloc(sizeof(_Node));
assert(_s != NULL);
_s->next = _Narg!=0?_Narg:_s;
_s->prev = _Parg!=0?_Parg:_s;
return _s;
}
};