yrs90
2005-04-27 08:42:12 UTC
It turns out that the pair<> issue isn't a copy constructor or operator=.
The problem is that map<A,B> creates pairs pair<const A, B>. The "const" is
what breaks assignability and keeps copy from working.
To overcome this I changed the list adapter implementation so that m_current
is accessor*, a pointer. This eliminates the need to copy. I created an
m_empty list-adapter member that m_current points to when there isn't an
item selected. This seems to work. I can add to the list, delete selected
items, etc.
Now, however, I am running into problems with rules that reference Current.
Since Current is a pair<> it is necessary to use ".second" in order to
access the data. Frequently, the rule that includes Current can be seen to
work correctly before an exception (for example it can put the selected item
in the title bar), but an exception will be thrown whenever some state
changes (insert, selection, etc).
I think it has something to do with the structure walking process. When I
was looking at this earlier, I think it was encountering null schema ?type?,
but now I seem to be getting some type of heap allocation error. I wonder
if m_current as a pointer into the underlying data is causing a circular
reference somewhere during change resolution.
I'll try to compose an explanation. First I'll try using a vector instead
of a map and see if a RULE using Current behaves any differently.
---
[This E-mail scanned for viruses by Declude Virus]
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
The problem is that map<A,B> creates pairs pair<const A, B>. The "const" is
what breaks assignability and keeps copy from working.
To overcome this I changed the list adapter implementation so that m_current
is accessor*, a pointer. This eliminates the need to copy. I created an
m_empty list-adapter member that m_current points to when there isn't an
item selected. This seems to work. I can add to the list, delete selected
items, etc.
Now, however, I am running into problems with rules that reference Current.
Since Current is a pair<> it is necessary to use ".second" in order to
access the data. Frequently, the rule that includes Current can be seen to
work correctly before an exception (for example it can put the selected item
in the title bar), but an exception will be thrown whenever some state
changes (insert, selection, etc).
I think it has something to do with the structure walking process. When I
was looking at this earlier, I think it was encountering null schema ?type?,
but now I seem to be getting some type of heap allocation error. I wonder
if m_current as a pointer into the underlying data is causing a circular
reference somewhere during change resolution.
I'll try to compose an explanation. First I'll try using a vector instead
of a map and see if a RULE using Current behaves any differently.
---
[This E-mail scanned for viruses by Declude Virus]
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix