Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
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
钟尚武
dlib
Commits
972e3253
Commit
972e3253
authored
Jan 12, 2014
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made dlib::array usable in C++11 range based for loops by adding
begin() and end() methods.
parent
1e9a6297
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
array_kernel.h
dlib/array/array_kernel.h
+7
-0
array_kernel_abstract.h
dlib/array/array_kernel_abstract.h
+34
-0
No files found.
dlib/array/array_kernel.h
View file @
972e3253
...
...
@@ -177,6 +177,13 @@ namespace dlib
T
&
item
);
typedef
T
*
iterator
;
typedef
const
T
*
const_iterator
;
iterator
begin
()
{
return
array_elements
;
}
const_iterator
begin
()
const
{
return
array_elements
;
}
iterator
end
()
{
return
array_elements
+
array_size
;
}
const_iterator
end
()
const
{
return
array_elements
+
array_size
;
}
private
:
typename
mem_manager
::
template
rebind
<
T
>::
other
pool
;
...
...
dlib/array/array_kernel_abstract.h
View file @
972e3253
...
...
@@ -254,6 +254,40 @@ namespace dlib
If an exception is thrown then it has no effect on *this.
!*/
typedef
T
*
iterator
;
typedef
const
T
*
const_iterator
;
iterator
begin
(
);
/*!
ensures
- returns an iterator that points to the first element in this array or
end() if the array is empty.
!*/
const_iterator
begin
(
)
const
;
/*!
ensures
- returns a const iterator that points to the first element in this
array or end() if the array is empty.
!*/
iterator
end
(
);
/*!
ensures
- returns an iterator that points to one past the end of the array.
!*/
const_iterator
end
(
)
const
;
/*!
ensures
- returns a const iterator that points to one past the end of the
array.
!*/
private
:
// restricted functions
...
...
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