From: Xu H. <g06...@nu...> - 2008-06-12 02:54:24
|
HI : Thanks very much, I know how to used it. Regards Haihua. -----Original Message----- From: bli...@li... [mailto:bli...@li...] On Behalf Of Erik Zeek Sent: Thursday, June 12, 2008 1:53 AM To: bli...@li... Subject: Re: [Blitz-support] How to used TinyVector in set. On Wed, Jun 11, 2008 at 6:15 AM, Xu Haihua <g06...@nu...> wrote: > > Hi everyone: > I have compiler error when I use TinyVector with STL set. > > I tried to insert the term to the set<TinyVector<int,2> > but have > compiler problem. (compiler is MSVC8) Can anyone give me an example > how to use set with TinyVector<int,2>? > Thanks. > > > The program is below: > > #include "stdafx.h" > #include <blitz/array.h> > #include <blitz/tinyvec.h> > #include<set> > > using namespace std; > using namespace blitz; > int main() > { > set<TinyVector<int,2> > myset; > TinyVector<int,2> term; > term[0]=1; > term[1]=2; > myset.insert(term); > } > std::set requires a comparison (<) operator returning a single bool. TinyVector returns an expression template that is (I believe) convertible to TinyVector<bool, 2>, not a bool. You'll need to supply your own comparison function (the second template argument to std::set). Erik -- ************************************************* Erik Zeek ze...@ma... ************************************************* Against stupidity the very gods Themselves contend in vain. - Johann Christoph Friedrich von Schiller (1801) ************************************************* ------------------------------------------------------------------------ - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Blitz-support mailing list Bli...@li... https://lists.sourceforge.net/lists/listinfo/blitz-support |