The use of STL has now been reduced to just

include "stl";

Everything is open now. For example:

//////////////////////////////////////////////////
#import <flx.flxh>
include "stl";

typedef ii = Vector::iterator[int];

var v = Vector::create[int]();
push_back (v,1);
push_back (v,2);
push_back (v,3);

var j = 0; until j==3 do
  print v.[j]; endl;
  ++j;
done;


var m = Map::create[int,int]();

insert(m,0,2);
insert(m,1,23);
insert(m,2,423);

j = 0; until j==3 do
  print m.[j]; endl;
  ++j;
done;

var i = begin m; until i == end m do
  def val k, val vl = deref i;
  print k; print " -> "; print vl; endl; ++i;
done;
//////////////////////////////////////////////////

Vector::iterator[int] could also be written as

stl_vector_iterator[int], avoiding all qualification ..
in fact I have no idea why Vector::iterator[int] actually
works (no such type is defined in module Vector ..).

All the modules are opened, and all the typeclasses
are now opened polymorphically. The instances are also
nested in the modules. Check out lib/stl.flx

Note that the modelling isn't finished: no support for
random access yet, the derived containers (Stack, Queue)
aren't fully supported, and neither are the GNU Hash table
versions (which on Windows should just use the usual red-black
tree versions).

Just one warning: Felix doesn't support const, so the associative
containers appear to support writing: Felix casts away const
to support writing to STL map pairs and Set values.
If you modify the key all hell will break loose.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to