Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
8070c788
Commit
8070c788
authored
Oct 18, 1997
by
Jason Merrill
Committed by
Jason Merrill
Oct 17, 1997
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* tree.h, vector.h: Fix accidental divergence from SGI release.
From-SVN: r15989
parent
c1215820
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
26 deletions
+40
-26
libstdc++/stl/ChangeLog
+4
-0
libstdc++/stl/tree.h
+2
-2
libstdc++/stl/vector.h
+34
-24
No files found.
libstdc++/stl/ChangeLog
View file @
8070c788
Fri Oct 17 19:07:42 1997 Jason Merrill <jason@yorick.cygnus.com>
* tree.h, vector.h: Fix accidental divergence from SGI release.
Tue Sep 9 19:47:28 1997 Jason Merrill <jason@yorick.cygnus.com>
* algo.h, algobase.h, alloc.h, bvector.h, deque.h, hashtable.h,
...
...
libstdc++/stl/tree.h
View file @
8070c788
...
...
@@ -523,10 +523,10 @@ private:
public
:
// allocation/deallocation
rb_tree
(
const
Compare
&
comp
=
Compare
())
:
key_compare
(
comp
),
node_count
(
0
)
{
init
();
}
:
node_count
(
0
),
key_compare
(
comp
)
{
init
();
}
rb_tree
(
const
rb_tree
<
Key
,
Value
,
KeyOfValue
,
Compare
,
Alloc
>&
x
)
:
key_compare
(
x
.
key_compare
),
node_count
(
0
)
{
:
node_count
(
0
),
key_compare
(
x
.
key_compare
)
{
header
=
get_node
();
color
(
header
)
=
__rb_tree_red
;
if
(
x
.
root
()
==
0
)
{
...
...
libstdc++/stl/vector.h
View file @
8070c788
...
...
@@ -61,6 +61,12 @@ protected:
void
deallocate
()
{
if
(
start
)
data_allocator
::
deallocate
(
start
,
end_of_storage
-
start
);
}
void
fill_initialize
(
size_type
n
,
const
T
&
value
)
{
start
=
allocate_and_fill
(
n
,
value
);
finish
=
start
+
n
;
end_of_storage
=
finish
;
}
public
:
iterator
begin
()
{
return
start
;
}
const_iterator
begin
()
const
{
return
start
;
}
...
...
@@ -75,22 +81,18 @@ public:
return
const_reverse_iterator
(
begin
());
}
size_type
size
()
const
{
return
size_type
(
end
()
-
begin
());
}
size_type
max_size
()
const
{
return
size_type
(
-
1
);
}
size_type
max_size
()
const
{
return
size_type
(
-
1
)
/
sizeof
(
T
)
;
}
size_type
capacity
()
const
{
return
size_type
(
end_of_storage
-
begin
());
}
bool
empty
()
const
{
return
begin
()
==
end
();
}
reference
operator
[](
size_type
n
)
{
return
*
(
begin
()
+
n
);
}
const_reference
operator
[](
size_type
n
)
const
{
return
*
(
begin
()
+
n
);
}
vector
()
:
start
(
0
),
finish
(
0
),
end_of_storage
(
0
)
{}
vector
(
size_type
n
,
const
T
&
value
)
{
start
=
allocate_and_fill
(
n
,
value
);
finish
=
start
+
n
;
end_of_storage
=
finish
;
}
explicit
vector
(
size_type
n
)
{
start
=
allocate_and_fill
(
n
,
T
());
finish
=
start
+
n
;
end_of_storage
=
finish
;
}
vector
(
size_type
n
,
const
T
&
value
)
{
fill_initialize
(
n
,
value
);
}
vector
(
int
n
,
const
T
&
value
)
{
fill_initialize
(
n
,
value
);
}
vector
(
long
n
,
const
T
&
value
)
{
fill_initialize
(
n
,
value
);
}
explicit
vector
(
size_type
n
)
{
fill_initialize
(
n
,
T
());
}
vector
(
const
vector
<
T
,
Alloc
>&
x
)
{
start
=
allocate_and_copy
(
x
.
end
()
-
x
.
begin
(),
x
.
begin
(),
x
.
end
());
finish
=
start
+
(
x
.
end
()
-
x
.
begin
());
...
...
@@ -119,7 +121,7 @@ public:
void
reserve
(
size_type
n
)
{
if
(
capacity
()
<
n
)
{
const
size_type
old_size
=
size
();
const
iterator
tmp
=
allocate_and_copy
(
n
,
start
,
finish
);
iterator
tmp
=
allocate_and_copy
(
n
,
start
,
finish
);
destroy
(
start
,
finish
);
deallocate
();
start
=
tmp
;
...
...
@@ -162,7 +164,15 @@ public:
void
insert
(
iterator
position
,
const_iterator
first
,
const_iterator
last
);
#endif
/* __STL_MEMBER_TEMPLATES */
void
insert
(
iterator
position
,
size_type
n
,
const
T
&
x
);
void
insert
(
iterator
pos
,
size_type
n
,
const
T
&
x
);
void
insert
(
iterator
pos
,
int
n
,
const
T
&
x
)
{
insert
(
pos
,
(
size_type
)
n
,
x
);
}
void
insert
(
iterator
pos
,
long
n
,
const
T
&
x
)
{
insert
(
pos
,
(
size_type
)
n
,
x
);
}
void
pop_back
()
{
--
finish
;
destroy
(
finish
);
...
...
@@ -291,7 +301,7 @@ template <class T, class Alloc>
vector
<
T
,
Alloc
>&
vector
<
T
,
Alloc
>::
operator
=
(
const
vector
<
T
,
Alloc
>&
x
)
{
if
(
&
x
!=
this
)
{
if
(
x
.
size
()
>
capacity
())
{
const
iterator
tmp
=
allocate_and_copy
(
x
.
end
()
-
x
.
begin
(),
iterator
tmp
=
allocate_and_copy
(
x
.
end
()
-
x
.
begin
(),
x
.
begin
(),
x
.
end
());
destroy
(
start
,
finish
);
deallocate
();
...
...
@@ -323,7 +333,7 @@ void vector<T, Alloc>::insert_aux(iterator position, const T& x) {
else
{
const
size_type
old_size
=
size
();
const
size_type
len
=
old_size
!=
0
?
2
*
old_size
:
1
;
const
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_finish
=
new_start
;
# ifdef __STL_USE_EXCEPTIONS
try
{
...
...
@@ -351,10 +361,10 @@ void vector<T, Alloc>::insert_aux(iterator position, const T& x) {
template
<
class
T
,
class
Alloc
>
void
vector
<
T
,
Alloc
>::
insert
(
iterator
position
,
size_type
n
,
const
T
&
x
)
{
if
(
n
!=
0
)
{
if
(
size_type
(
end_of_storage
-
finish
)
>=
n
)
{
if
(
size_type
(
end_of_storage
-
finish
)
>=
n
)
{
T
x_copy
=
x
;
const
size_type
elems_after
=
finish
-
position
;
const
iterator
old_finish
=
finish
;
iterator
old_finish
=
finish
;
if
(
elems_after
>
n
)
{
uninitialized_copy
(
finish
-
n
,
finish
,
finish
);
finish
+=
n
;
...
...
@@ -372,7 +382,7 @@ void vector<T, Alloc>::insert(iterator position, size_type n, const T& x) {
else
{
const
size_type
old_size
=
size
();
const
size_type
len
=
old_size
+
max
(
old_size
,
n
);
const
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_finish
=
new_start
;
# ifdef __STL_USE_EXCEPTIONS
try
{
...
...
@@ -417,9 +427,9 @@ void vector<T, Alloc>::range_insert(iterator position,
if
(
first
!=
last
)
{
size_type
n
=
0
;
distance
(
first
,
last
,
n
);
if
(
size_type
(
end_of_storage
-
finish
)
>=
n
)
{
if
(
size_type
(
end_of_storage
-
finish
)
>=
n
)
{
const
size_type
elems_after
=
finish
-
position
;
const
iterator
old_finish
=
finish
;
iterator
old_finish
=
finish
;
if
(
elems_after
>
n
)
{
uninitialized_copy
(
finish
-
n
,
finish
,
finish
);
finish
+=
n
;
...
...
@@ -439,7 +449,7 @@ void vector<T, Alloc>::range_insert(iterator position,
else
{
const
size_type
old_size
=
size
();
const
size_type
len
=
old_size
+
max
(
old_size
,
n
);
const
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_finish
=
new_start
;
# ifdef __STL_USE_EXCEPTIONS
try
{
...
...
@@ -473,9 +483,9 @@ void vector<T, Alloc>::insert(iterator position,
if
(
first
!=
last
)
{
size_type
n
=
0
;
distance
(
first
,
last
,
n
);
if
(
end_of_storage
-
finish
>=
n
)
{
if
(
size_type
(
end_of_storage
-
finish
)
>=
n
)
{
const
size_type
elems_after
=
finish
-
position
;
const
iterator
old_finish
=
finish
;
iterator
old_finish
=
finish
;
if
(
elems_after
>
n
)
{
uninitialized_copy
(
finish
-
n
,
finish
,
finish
);
finish
+=
n
;
...
...
@@ -493,7 +503,7 @@ void vector<T, Alloc>::insert(iterator position,
else
{
const
size_type
old_size
=
size
();
const
size_type
len
=
old_size
+
max
(
old_size
,
n
);
const
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_start
=
data_allocator
::
allocate
(
len
);
iterator
new_finish
=
new_start
;
# ifdef __STL_USE_EXCEPTIONS
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment