Add extra comment, use end() for invalid iterator.
This commit is contained in:
parent
d8e00df06a
commit
62673399a8
1 changed files with 9 additions and 6 deletions
|
@ -42,10 +42,13 @@ namespace image {
|
|||
#else
|
||||
const int tile_size = 72;
|
||||
#endif
|
||||
// Iterators from this dummy list are needed to ensure that iterator member of cache_item
|
||||
// is always non-singular iterator thus avoiding
|
||||
// "Copy-contruct from singular iterator" error
|
||||
// when libstdc++ debug mode is enabled.
|
||||
/**
|
||||
* Iterators from this dummy list are needed to ensure that iterator member
|
||||
* of cache_item is always non-singular iterator thus avoiding
|
||||
* "Copy-contruct from singular iterator" error when libstdc++ debug mode
|
||||
* is enabled. Note copying a singular iterator is undefined behaviour by
|
||||
* the C++ standard.
|
||||
*/
|
||||
extern std::list<int> dummy_list;
|
||||
|
||||
template<typename T>
|
||||
|
@ -53,14 +56,14 @@ namespace image {
|
|||
cache_item() :
|
||||
loaded(false),
|
||||
item() ,
|
||||
position(dummy_list.begin())
|
||||
position(dummy_list.end())
|
||||
{
|
||||
}
|
||||
|
||||
cache_item(T item) :
|
||||
loaded(true),
|
||||
item(item),
|
||||
position(dummy_list.begin())
|
||||
position(dummy_list.end())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue