# Possible error in itk::VectorContainer::End() function

**URL:** https://discourse.itk.org/t/possible-error-in-itk-end-function/1458
**Category:** Community
**Created:** [December 5, 2018, 11:06am UTC](https://discourse.itk.org/t/possible-error-in-itk-end-function/1458 "2018-12-05T11:06:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Johannes\_Keustermans](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/cdc98d/32.png) [@Johannes\_Keustermans](https://discourse.itk.org/u/Johannes_Keustermans)
#### Post date: [December 5, 2018, 11:06am UTC](https://discourse.itk.org/t/possible-error-in-itk-end-function/1458/1 "2018-12-05T11:06:00Z")

</div>

Hi,

The current implementation of this function (the constant version) is as follows:  
“return ConstIterator( this-\>VectorType::size() - 1, this-\>VectorType::end() );”  
But should this not be  
“return ConstIterator( this-\>VectorType::size(), this-\>VectorType::end() );”  
As the end iterator is one past the last element in the container?  
The same is true for the non-constant version.

Kind regards,  
Johannes

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [December 5, 2018, 4:55pm UTC](https://discourse.itk.org/t/possible-error-in-itk-end-function/1458/2 "2018-12-05T16:55:03Z")

</div>

ITK’s image iterators have `AtEnd()` method, so this might be following that pattern. But it could very well be a bug. To determine that, classes which use `VectorContainer` should be examined. Also, there is no test for `VectorContainer` to quickly check how it is supposed to work. Is someone familiar with `VectorContainer`?
