[mpl] possible bug in insert<set, x>

I'm having trouble with insert<> as called on a set. Specifically, it doesn't seem to be possible to iterate over sets built with insert<>. The following code, for example, works correctly (or at least, compiles without errors): --- typedef set<double, char> m_set; typedef transform<m_set, lambda<identity<_1> > >::type result; --- but the following (which as I understand it should be equivalent) fails to compile: --- typedef insert<insert<set<>, double>::type, char>::type m_set; typedef transform<m_set, lambda<identity<_1> > >::type result; --- The error consists basically of the compiler complaining there's no member type next_ in set<mpl_::na, mpl_::na ...>. I've provided the full error log in an attachment (I'm using g++ 4.0.2 and Boost 1.33.0). The bug isn't specific to transform; I've encountered it when using other algorithms when they iterate over a set built with inserts. It's possible this problem relates to the problem discussed in this message: (http://thread.gmane.org/gmane.comp.lib.boost.devel/116988), which also concerns non-identical behavior for sets built with the two methods. I hope I'm not doing something stupid, I'm starting to feel like a broken record here...

On 10/7/05, Geoffrey Romer <geoff.romer@gmail.com> wrote:
I'm having trouble with insert<> as called on a set. Specifically, it doesn't seem to be possible to iterate over sets built with insert<>. The following code, for example, works correctly (or at least, compiles without errors):
--- typedef set<double, char> m_set; typedef transform<m_set, lambda<identity<_1> > >::type result; ---
but the following (which as I understand it should be equivalent) fails to compile:
--- typedef insert<insert<set<>, double>::type, char>::type m_set; typedef transform<m_set, lambda<identity<_1> > >::type result; ---
On the assumption that this is a bug, or at least a non-obvious usage error, can anyone suggest a workaround? At present I can find no way to insert an item into a set in a way that produces a usable set, and this is a major obstacle in the project I'm working on. Also, is boost or boost-users the preferred forum for these sorts of questions? boost-users seems more appropriate (since this may, after all, be an error on my part), but I've found boost to be much more responsive.

Geoffrey Romer <geoff.romer@gmail.com> writes:
On 10/7/05, Geoffrey Romer <geoff.romer@gmail.com> wrote:
I'm having trouble with insert<> as called on a set. Specifically, it doesn't seem to be possible to iterate over sets built with insert<>. The following code, for example, works correctly (or at least, compiles without errors):
--- typedef set<double, char> m_set; typedef transform<m_set, lambda<identity<_1> > >::type result; ^^^^^^^^^^^^^^^^^^^^^ identity<_1>
---
but the following (which as I understand it should be equivalent) fails to compile:
--- typedef insert<insert<set<>, double>::type, char>::type m_set; typedef transform<m_set, lambda<identity<_1> > >::type result; ^^^^^^^^^^^^^^^^^^^^^ identity<_1>
---
On the assumption that this is a bug,
It is, thanks for the report.
or at least a non-obvious usage error, can anyone suggest a workaround?
Try this: typedef insert<insert<set0<>, double>::type, char>::type m_set; ^^^^^^ typedef transform<m_set,identity<_1> >::type result;
At present I can find no way to insert an item into a set in a way that produces a usable set, and this is a major obstacle in the project I'm working on.
Also, is boost or boost-users the preferred forum for these sorts of questions? boost-users seems more appropriate (since this may, after all, be an error on my part), but I've found boost to be much more responsive.
As far as MPL is concerned, there is no intentional discrimination of them on my side, but I think the developers list definitely has more readers that would be able to comment on the library problems of similar nature, and your posts would be well appropriate there. -- Aleksey Gurtovoy MetaCommunications Engineering
participants (2)
-
Aleksey Gurtovoy
-
Geoffrey Romer