Re: No cooperation between dictionaries from Cint and Reflex

From: Roel Aaij <Roel.Aaij_at_cern.ch>
Date: Tue, 31 Jan 2012 21:16:33 +0100


Hi Wim,

>> And then in the list of generated classes:
>> class std::pair<std::_Rb_tree_iterator<std::pair<const
>> std::basic_string<char>,double> >,bool>

>
> yes, but still what I'd argue is that the one needed is instead:
>
> class
> std::pair<std::_Rb_tree_iterator<std::pair<std::basic_string<char>,double>
>>,bool>

I've added this explicit instantiation and I can see in the genreflex output that it is included in the dictionary, unfortunately the same error persists...

One thing I noticed when I was setting up these dictionaries is that the types reported by python's type function were slightly different:

For this map time, insert works when I use pair<const string, bool> >>> type(gbl.std.map('string', 'bool')()) <class 'PyCintex.map<string,bool>'>
>>> gbl.std.map('string', 'bool')
<class '__main__.map<string,bool>::iterator'>

>>> type(gbl.std.map('string', 'double')()) <class 'PyCintex.map<string,double,less<string>,allocator<pair<const string,double> > >'> >>> gbl.std.map('string', 'double').iterator <class '__main__.map<string,double,less<string>,allocator<pair<const string,double> > >::iterator'> >>> gbl.std.pair(gbl.std.map('string', 'double').iterator, 'bool') <class 'PyCintex.pair<map<string,double,less<string>,allocator<pair<const string,double> > >::iterator,bool>'>

So it seems there are some dictionaries available, but the correct one cannot be found when the return type for the insert method is required.

Instantiating this last type gives:
>>> gbl.std.pair(gbl.std.map('string', 'double').iterator, 'bool')() <ROOT.pair<map<string,double>::iterator,bool> object at 0x(nil)> Where the 0x(nil) looks somewhat stange.

Thanks for all the help so far,

Roel

> In C++, assignments (i.e. on return) between the former and latter work
> fine
> b/c the string always gets copied, so there's no issue with the
> difference in
> const-ness. I guess that's why the STL implementation chose to add the
> const
> in the iterator typedef for this case.
>
> However, in the class-name parsing they end up being seen as different
> classes.
> And I believe correctly so. For example, any non-const operation (e.g.
> append())
> would be not be allowed on iterator::first in the former case, whereas
> it would
> on the latter. Even (or especially so) in C++.
>
> Now, I don't know how to convince Reflex to change the typedef that it
> found,
> but generating the dictionary for the class as suggested should
> hopefully work.
>
> Best regards,
> Wim

-- 
Roel Aaij                   
Cern, office 13-1-20        Tel: +41 (0)22 76 76284
CH-1211 Genève              Mob: +41 (0)79 9272 882


Received on Tue Jan 31 2012 - 21:19:19 CET

This archive was generated by hypermail 2.2.0 : Tue Jan 31 2012 - 23:50:01 CET