I've been having a poke around in the boost source code
boost/mpl/set/aux_/iterator.hpp
 
and I've found that if I tweak the partial specialization
 
template <typename Set, typename Tail>
struct next< s_iter< Set, Tail > >
    : s_iter_get< Set, typename Tail::base >
{
};
 
to
 
template <typename Set, typename Tail>
struct next< s_iter< Set, Tail > >
{
    typedef typename s_iter_get< Set, typename Tail::base >::type type;
};
 
Then everything works fine on solaris S1S12u1.
 
Is there a problem with S1S12u1 wrt to deep metafunction forwarding?
Is this a suitable workaround?
 
I've still not figured out why the boost::mpl::copy works ok with sets ( surely they will also have to use s_iter_get during the fold ) - I'm assuming that the views 'invokes' boost::mpl::next in such a way which isn't supported by the compiler.
 
 


From: chamber_j@hotmail.com
To: boost-users@lists.boost.org
Subject: Problems with copying view on mpl set on solaris compiler.
Date: Mon, 22 Mar 2010 12:57:58 +0000

I'm trying to get the following to compile on solaris using S1S12u1;

#include <boost/mpl/copy.hpp>
#include <boost/mpl/set.hpp>
#include <boost/type_traits.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/inserter.hpp>
#include <boost/mpl/insert.hpp>
#include <boost/mpl/filter_view.hpp>

typedef
        boost::mpl::copy<
                boost::mpl::filter_view<
                        boost::mpl::set<int>,
                        boost::is_same<boost::mpl::_, int>
                >,
                boost::mpl::inserter<
                        boost::mpl::set<>,
                        boost::mpl::insert<boost::mpl::_, boost::mpl::_>
                >
        >::type type;
 
template <class undefined>
struct Debug;
 
Debug<type> debug;

int main(int argc, char *argv[])
{
        return 0;
}
 
and I get the following compiler errors
 
"boost_1_42_0/boost/mpl/aux_/filter_iter.hpp", line 66: Error: Redefining boost::mpl::next<boost::mpl::T> after use in boost::mpl::aux::filter_i
ter<boost::mpl::s_iter<boost::mpl::set<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_
::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::s_item<int, boost::mpl::set0<mpl_::na>>>, boo
st::mpl::s_iter<boost::mpl::set<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, m
pl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::set0<mpl_::na>>, boost::mpl::protect<boost::mpl::bin
d2<boost::mpl::quote2<boost::is_same<boost::T, boost::U>, mpl_::void_>, mpl_::arg<-1>, int>, 0>>.
"boost_1_42_0/boost/mpl/next_prior.hpp", line 31:     Where: While specializing "boost::mpl::aux::filter_iter<boost::mpl::s_iter<boost::mpl::set
<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mp
l_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::s_item<int, boost::mpl::set0<mpl_::na>>>, boost::mpl::s_iter<boost::mpl::set<int, c
har, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
 mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::set0<mpl_::na>>, boost::mpl::protect<boost::mpl::bind2<boost::mpl::quote2<boost::is_same<b
oost::T, boost::U>, mpl_::void_>, mpl_::arg<-1>, int>, 0>>".
"boost_1_42_0/boost/mpl/next_prior.hpp", line 31:     Where: Specialized in boost::mpl::next<boost::mpl::aux::filter_iter<boost::mpl::s_iter<boo
st::mpl::set<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::s_item<int, boost::mpl::set0<mpl_::na>>>, boost::mpl::s_iter<boost::mpl
::set<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::n
a, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::set0<mpl_::na>>, boost::mpl::protect<boost::mpl::bind2<boost::mpl::quote2<boos
t::is_same<boost::T, boost::U>, mpl_::void_>, mpl_::arg<-1>, int>, 0>>>.
"boost_1_42_0/boost/mpl/aux_/preprocessed/plain/fold_impl.hpp", line 162:     Where: Specialized in boost::mpl::aux::fold_impl<-1, boost::mpl::a
ux::filter_iter<boost::mpl::s_iter<boost::mpl::set<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mp
l_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::s_item<int, boost::mpl::set0<mpl_
::na>>>, boost::mpl::s_iter<boost::mpl::set<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
 mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::set0<mpl_::na>>, boost::mpl::protect<boo
st::mpl::bind2<boost::mpl::quote2<boost::is_same<boost::T, boost::U>, mpl_::void_>, mpl_::arg<-1>, int>, 0>>, boost::mpl::aux::filter_iter<boost
::mpl::s_iter<boost::mpl::set<int, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl
_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::set0<mpl_::na>>, boost::mpl::s_iter<boost::mpl::set<in
t, char, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_:
:na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::mpl::set0<mpl_::na>>, boost::mpl::protect<boost::mpl::bind2<boost::mpl::quote2<boost::is_sa
me<boost::T, boost::U>, mpl_::void_>, mpl_::arg<-1>, int>, 0>>, boost::mpl::set<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_
::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::
mpl::insert<mpl_::arg<-1>, mpl_::arg<-1>, mpl_::na>>.
"boost_1_42_0/boost/mpl/fold.hpp", line 39:     Where: Specialized in boost::mpl::fold<boost::mpl::filter_view<boost::mpl::set<int, char, mpl_::
na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na>, boost::is_same<mpl_::arg<-1>, int>>, boost::mpl::set<mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boo
st::mpl::insert<mpl_::arg<-1>, mpl_::arg<-1>, mpl_::na>>.
"boost_1_42_0/boost/mpl/copy.hpp", line 36:     Where: Specialized in boost::mpl::aux::copy_impl<boost::mpl::filter_view<boost::mpl::set<int, ch
ar, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na, mpl_::na>, boost::is_same<mpl_::arg<-1>, int>>, boost::mpl::inserter<boost::mpl::set<mpl_::na, mpl_::na, mpl_::na,
 mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl
_::na, mpl_::na, mpl_::na>, boost::mpl::insert<mpl_::arg<-1>, mpl_::arg<-1>, mpl_::na>>>.
"boost_1_42_0/boost/mpl/copy.hpp", line 54:     Where: Specialized in boost::mpl::copy<boost::mpl::filter_view<boost::mpl::set<int, char, mpl_::
na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
mpl_::na, mpl_::na, mpl_::na>, boost::is_same<mpl_::arg<-1>, int>>, boost::mpl::inserter<boost::mpl::set<mpl_::na, mpl_::na, mpl_::na, mpl_::na,
 mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl
_::na, mpl_::na>, boost::mpl::insert<mpl_::arg<-1>, mpl_::arg<-1>, mpl_::na>>>.
"filter_view.cpp", line 19:     Where: Specialized in non-template code.
"filter_view.cpp", line 24: Error: In this declaration "debug" is of an incomplete type "Debug<boost::mpl::s_item<int, boost::mpl::set0<mpl_::na
>>>".
2 Error(s) detected.
 
 
You can see by the debug that the program has managed to deduce the correct type, even though it errored.
 
On GCC-4.1.1 this gives
 

filter_view.cpp:24: error: aggregate 'Debug<boost::mpl::s_item<int, boost::mpl::set0<mpl_::na> > > debug' has incomplete type and cannot be defined
 
Which is exactly what I want.
 
Anyone else had these issues, found workarounds, etc?
 
This problem also occurs with boost::mpl::transform_view, but appears to work for boost::mpl::joint_view.
 
Any help appreciated.
 
Jon.


 
 
 




Do you have a story that started on Hotmail? Tell us now


We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now