Implemented decrement and distance_to for LLInstanceTracker::instance_iter and LLInstanceTracker::key_iter
Technically, both nested iterator classes in llinstance tracker should be derived from a common base implementation of boost::iterator_facade for std::maps(LLInstanceTracker::InstanceMap), they'd only need to implement dereference individually
This commit is contained in:
@@ -86,6 +86,7 @@ class LLInstanceTracker : public LLInstanceTrackerBase
|
||||
{
|
||||
typedef LLInstanceTracker<T, KEY> MyT;
|
||||
typedef typename std::map<KEY, T*> InstanceMap;
|
||||
typedef typename InstanceMap::iterator::difference_type difference_type;
|
||||
struct StaticData: public StaticBase
|
||||
{
|
||||
InstanceMap sMap;
|
||||
@@ -115,6 +116,11 @@ public:
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
void increment() { mIterator++; }
|
||||
void decrement() { --mIterator; }
|
||||
difference_type distance_to(instance_iter const& other) const
|
||||
{
|
||||
return std::distance(mIterator, other.mIterator);
|
||||
}
|
||||
bool equal(instance_iter const& other) const
|
||||
{
|
||||
return mIterator == other.mIterator;
|
||||
@@ -155,6 +161,11 @@ public:
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
void increment() { mIterator++; }
|
||||
void decrement() { --mIterator; }
|
||||
difference_type distance_to(instance_iter const& other) const
|
||||
{
|
||||
return std::distance(mIterator, other.mIterator);
|
||||
}
|
||||
bool equal(key_iter const& other) const
|
||||
{
|
||||
return mIterator == other.mIterator;
|
||||
|
||||
Reference in New Issue
Block a user