|
Boost-Commit : |
From: chintanraoh_at_[hidden]
Date: 2008-06-17 13:35:00
Author: chintanraoh
Date: 2008-06-17 13:35:00 EDT (Tue, 17 Jun 2008)
New Revision: 46452
URL: http://svn.boost.org/trac/boost/changeset/46452
Log:
iterator conversions const_iterator
Text files modified:
sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
Modified: sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp
==============================================================================
--- sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp (original)
+++ sandbox/SOC/2008/digital_searching/dsearch/boost/dsearch/patricia_iterator.hpp 2008-06-17 13:35:00 EDT (Tue, 17 Jun 2008)
@@ -1,6 +1,8 @@
#ifndef BOOST_DSEARCH_PATRICIA_ITERATOR_HPP
#define BOOST_DSEARCH_PATRICIA_ITERATOR_HPP
#include<boost/iterator/iterator_facade.hpp>
+#include<boost/utility/enable_if.hpp>
+#include<boost/type_traits/is_convertible.hpp>
namespace boost{
namespace dsearch{
@@ -9,6 +11,7 @@
:public iterator_facade< patricia_iterator<Value_type,Node_type, Alloc>,
Value_type, bidirectional_traversal_tag >
{
+ struct enabler {};
friend class boost::iterator_core_access;
Node_type *cur;
Node_type *next;
@@ -61,8 +64,11 @@
return next->value;
}
- template<class T>
- bool equal(T &other ) const
+ template<class V,class N,class A>
+ bool equal(patricia_iterator<V,N,A> const &other,
+ typename enable_if< is_convertible<V*,Value_type*>,
+ enabler >::type = enabler()
+ ) const
{
if ( cur == other.cur && next == other.next )
return true;
@@ -76,7 +82,6 @@
patricia_iterator(Node_type *root, bool start)
{
-
if(start)
{
if(root==0)
@@ -101,6 +106,14 @@
}
return;
}
+
+ template<class V,class N,class A>
+ patricia_iterator ( patricia_iterator<V,N,A> const& other,
+ typename enable_if< is_convertible<V*,Value_type*>,
+ enabler >::type = enabler()
+ ) : cur(other.cur),next(other.next)
+ {
+ }
};
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk