Home » U++ Library support » U++ Core » how can i use iterators with NTL?
how can i use iterators with NTL? [message #16261] |
Wed, 04 June 2008 23:46  |
ajmf77
Messages: 6 Registered: December 2006 Location: Santiago de Chile
|
Promising Member |
|
|
Hi everyone!
My question arises from my need to translate a KD-tree header. In the STL view of the world, initializing a vector variable with another previous existent vector, we can use iterators in one line.
How can i do the same with NTL?
ALA STL example:
vector<float> v1;
***
vector<float> v2(v1.begin,v2.begin+some_int);
thanxs in advance!
Alejandro Muņoz Fonttz
from Chile
|
|
|
|
Re: how can i use iterators with NTL? [message #16269 is a reply to message #16262] |
Thu, 05 June 2008 14:30   |
ajmf77
Messages: 6 Registered: December 2006 Location: Santiago de Chile
|
Promising Member |
|
|
thax for your quick reply!
i has some errors in my former explanation, but you catch my idea.
Well, i use Insert(...), altought Append(...) is more appropiate.
And, again over iterators, in
template <class T, class Less> void Sort(T& c, const Less& less)
if my class T have two components, i. e.
class Point
{
float x,y
.
.
.
}
and i want to use in a class like
kdtree
{
.
. some declarations
.
}
i can employ, in a STL style, a
class PXorder{
bool operator () (point &u, point &v)
{
.
. some returns, based on if u>v or u<v
.
}
}
declared and implemented within kdtree class
but if we use
Vector<point> v;
Sort(v,PXorder());
the compiler returns ERROR: 'const PXorder' as argument 'this' in PXorder(Point,Point), discard qualifiers?
any suggestion?
PD: I will post source code later, thanx!
|
|
|
|
Goto Forum:
Current Time: Sat Jun 14 15:31:55 CEST 2025
Total time taken to generate the page: 0.04306 seconds
|