Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Koch
dune-common
Commits
9ed7796a
Commit
9ed7796a
authored
18 years ago
by
Markus Blatt
Browse files
Options
Downloads
Patches
Plain Diff
Not all iterators have be sortable
[[Imported from SVN: r4912]]
parent
a518524c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/test/iteratortest.hh
+32
-11
32 additions, 11 deletions
common/test/iteratortest.hh
with
32 additions
and
11 deletions
common/test/iteratortest.hh
+
32
−
11
View file @
9ed7796a
...
...
@@ -195,17 +195,33 @@ int testConstIterator(Iter& begin, Iter& end, Opt& opt)
return
ret
;
}
template
<
class
Container
,
typename
IteratorTag
>
void
testSorting
(
Container
&
C
,
IteratorTag
tag
)
{
}
template
<
class
Container
>
void
testSorting
(
Container
&
c
,
std
::
random_access_iterator_tag
)
template
<
bool
>
struct
TestSorting
{
std
::
sort
(
c
.
begin
(),
c
.
end
());
template
<
class
Container
,
typename
IteratorTag
>
static
void
testSorting
(
Container
&
c
,
IteratorTag
tag
)
{}
template
<
class
Container
>
static
void
testSorting
(
Container
&
c
,
std
::
random_access_iterator_tag
)
{
std
::
sort
(
c
.
begin
(),
c
.
end
());
}
}
;
template
<
class
Container
,
class
Opt
>
template
<
>
struct
TestSorting
<
false
>
{
template
<
class
Container
>
static
void
testSorting
(
Container
&
c
,
std
::
random_access_iterator_tag
)
{}
template
<
class
Container
,
typename
IteratorTag
>
static
void
testSorting
(
Container
&
c
,
IteratorTag
tag
)
{}
};
template
<
class
Container
,
class
Opt
,
bool
testSort
>
int
testIterator
(
Container
&
c
,
Opt
&
opt
)
{
typename
Container
::
iterator
begin
=
c
.
begin
(),
end
=
c
.
end
();
...
...
@@ -214,10 +230,9 @@ int testIterator(Container& c, Opt& opt)
typename
Container
::
const_iterator
cend
=
c
.
end
();
int
ret
=
0
;
testSorting
(
c
,
typename
std
::
iterator_traits
<
typename
Container
::
iterator
>::
iterator_category
());
TestSorting
<
testSort
>::
testSorting
(
c
,
typename
std
::
iterator_traits
<
typename
Container
::
iterator
>::
iterator_category
());
if
(
end
!=
cend
||
cend
!=
end
)
if
(
end
!=
cend
||
cend
!=
end
)
{
std
::
cerr
<<
"constant and mutable iterators should be equal!"
<<
std
::
endl
;
ret
=
1
;
...
...
@@ -226,6 +241,12 @@ int testIterator(Container& c, Opt& opt)
testIterator
(
begin
,
end
,
opt
);
}
template
<
class
Container
,
class
Opt
>
int
testIterator
(
Container
&
c
,
Opt
&
opt
)
{
testIterator
<
Container
,
Opt
,
true
>
(
c
,
opt
);
}
template
<
class
Iter
,
class
Opt
>
void
testAssignment
(
Iter
begin
,
Iter
end
,
Opt
&
opt
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment