Skip to content

Commit ef44e3f

Browse files
N-Dekkerhjmjohnson
authored andcommitted
ENH: Add cbegin() and cend() member functions to Index, Offset, Size
Mirrored the corresponding member functions of `std::array`. Following commit 549a19c "STYLE: Change aggregate classes to mirror std::array", Hans Johnson, 2018-02-12
1 parent b85fc62 commit ef44e3f

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

Modules/Core/Common/include/itkIndex.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ struct ITK_TEMPLATE_EXPORT Index final
346346
std::swap(m_InternalArray, other.m_InternalArray);
347347
}
348348

349+
const_iterator
350+
cbegin() const
351+
{
352+
return &m_InternalArray[0];
353+
}
354+
349355
iterator
350356
begin()
351357
{
@@ -358,6 +364,12 @@ struct ITK_TEMPLATE_EXPORT Index final
358364
return &m_InternalArray[0];
359365
}
360366

367+
const_iterator
368+
cend() const
369+
{
370+
return &m_InternalArray[VDimension];
371+
}
372+
361373
iterator
362374
end()
363375
{

Modules/Core/Common/include/itkOffset.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ struct ITK_TEMPLATE_EXPORT Offset final
299299
std::swap(m_InternalArray, other.m_InternalArray);
300300
}
301301

302+
const_iterator
303+
cbegin() const
304+
{
305+
return &m_InternalArray[0];
306+
}
307+
302308
iterator
303309
begin()
304310
{
@@ -311,6 +317,12 @@ struct ITK_TEMPLATE_EXPORT Offset final
311317
return &m_InternalArray[0];
312318
}
313319

320+
const_iterator
321+
cend() const
322+
{
323+
return &m_InternalArray[VDimension];
324+
}
325+
314326
iterator
315327
end()
316328
{

Modules/Core/Common/include/itkSize.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,12 @@ struct ITK_TEMPLATE_EXPORT Size final
258258
std::swap(m_InternalArray, other.m_InternalArray);
259259
}
260260

261+
const_iterator
262+
cbegin() const
263+
{
264+
return &m_InternalArray[0];
265+
}
266+
261267
iterator
262268
begin()
263269
{
@@ -270,6 +276,12 @@ struct ITK_TEMPLATE_EXPORT Size final
270276
return &m_InternalArray[0];
271277
}
272278

279+
const_iterator
280+
cend() const
281+
{
282+
return &m_InternalArray[VDimension];
283+
}
284+
273285
iterator
274286
end()
275287
{

0 commit comments

Comments
 (0)