hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
 *
 * 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 supporting documentation.  Hewlett-Packard Company makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 *
 *
 * 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 supporting documentation.  Silicon Graphics makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 */
 
/*
Copyright (c) 2007 Lao wen bo
 
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
 
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
 
    1. The origin of this software must not be misrepresented; you must not
    claim that you wrote the original software. If you use this software
    in a product, an acknowledgment in the product documentation would be
    appreciated but is not required.
 
    2. Altered source versions must be plainly marked as such, and must not be
    misrepresented as being the original software.
 
    3. This notice may not be removed or altered from any source
    distribution.
 
   Lao wen bo
   viewpl(at)gmail.com
 */
 
#ifndef _C_VECTOR_H
#define _C_VECTOR_H
 
#include "c_def.h"
#include "c_iterator.h"
 
#define c_vector            _c_vector
#define c_pvector            _c_pvector
#define c_vector_create            __c_vector
#define c_vector_destroy        __c_rotcev
#define c_vector_begin            _c_vector_begin
#define c_vector_end            _c_vector_end
#define c_vector_rbegin            _c_vector_rbegin
#define c_vector_rend            _c_vector_rend
#define c_vector_size            _c_vector_size
#define c_vector_max_size        _c_vector_max_size
#define c_vector_empty            _c_vector_empty
#define c_vector_at            _c_vector_at
#define c_vector_assign            _c_vector_assign
#define c_vector_reserve        _c_vector_reserve
#define c_vector_front            _c_vector_front
#define c_vector_back            _c_vector_back
#define c_vector_push_back        _c_vector_push_back
#define c_vector_pop_back        _c_vector_pop_back
#define c_vector_swap            _c_vector_swap
#define c_vector_insert            _c_vector_insert
#define c_vector_insert2        _c_vector_insert2
#define c_vector_fill_insert        _c_vector_fill_insert
#define c_vector_erase            _c_vector_erase
#define c_vector_erase2            _c_vector_erase2
#define c_vector_clear            _c_vector_clear
#define c_vector_resize            _c_vector_resize
#define c_vector_equal            _c_vector_equal
#define c_vector_less            _c_vector_less
#define abs                  _abs
 
typedef struct c_vector
{
    COMPARER _cmp;
    void * _l;
} c_vector, * c_pvector;
 
int  _abs(signed int i);
void __c_vector(c_pvector thiz, COMPARER pcmp);
void __c_rotcev(c_pvector thiz);
c_iterator c_vector_begin(c_pvector thiz);
c_iterator c_vector_end(c_pvector thiz);
c_reverse_iterator c_vector_rbegin(c_pvector thiz);
c_reverse_iterator c_vector_rend(c_pvector thiz);
size_type c_vector_size(c_pvector thiz);
size_type c_vector_max_size(c_pvector thiz);
size_type c_vector_capacity(c_pvector thiz);
c_bool c_vector_empty(c_pvector thiz);
value_type c_vector_at(c_pvector thiz, size_type n);
c_pvector c_vector_assign(c_pvector thiz, const c_pvector V);
void c_vector_reserve(c_pvector thiz, size_t n);
value_type c_vector_front(c_pvector thiz);
value_type c_vector_back(c_pvector thiz);
void c_vector_push_back(c_pvector thiz, const value_type val);
void c_vector_pop_back(c_pvector thiz);
void c_vector_swap(c_pvector thiz, c_pvector V);
c_iterator c_vector_insert(c_pvector thiz, c_iterator pos, const value_type val);
void c_vector_insert2(c_pvector thiz, c_iterator pos, c_iterator first, c_iterator last);
void c_vector_fill_insert(c_pvector thiz, c_iterator pos, size_type n, const value_type val);
c_iterator c_vector_erase(c_pvector thiz, c_iterator pos);
c_iterator c_vector_erase2(c_pvector thiz, c_iterator first, c_iterator last);
void c_vector_clear(c_pvector thiz);
void c_vector_resize(c_pvector thiz, size_t n);
c_bool c_vector_equal(c_pvector thiz, const c_pvector V);
c_bool c_vector_less(c_pvector thiz, const c_pvector V);
 
 
#endif /* _C_VECTOR_H */