Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] remove_if and as_vector with Placeholder Expression as predicate
From: Jeffrey Lee Hellrung, Jr. (jeffrey.hellrung_at_[hidden])
Date: 2012-11-12 21:47:11


On Mon, Nov 12, 2012 at 9:11 AM, Felipe Magno de Almeida <
felipe.m.almeida_at_[hidden]> wrote:

> Hello,
>
> I'm trying to remove_if a few elements from a fusion sequence. But it
> is instantiating
> my predicate with the placeholder from MPL later on. Including with
> as_vector.
>
> The following code generates the error code I'm pasting by the end of
> the message.
> I'm using GCC 4.7.2 and Linux x86_64. If I wrap meta_func<mpl::_1> in
> a mpl::lambda<>::type
> then the errors following the first error messages is what I get. I'm
> not sure if I'm doing
> something wrong here. If anyone could please shed some light, I would
> really appreciate it.
>

Works on MSVC9, so...I dunno :(

#include <boost/fusion/include/as_vector.hpp>
> #include <boost/fusion/include/remove_if.hpp>
>
> namespace mpl = boost::mpl;
> namespace fusion = boost::fusion;
>
> struct element
> {
> typedef mpl::false_ type;
> };
>
> template <typename T>
> struct meta_func
> {
> typedef typename T::type type;
> };
>
> int main()
> {
> fusion::vector<element, element> e;
> fusion::as_vector(fusion::remove_if<meta_func<mpl::_1> >(e));
> }
>
> --
>
> main.cpp: In instantiation of ‘struct meta_func<mpl_::arg<1> >’:
> ../boost/boost_1_51_0/boost/mpl/aux_/nested_type_wknd.hpp:26:31:
> required from ‘struct
> boost::mpl::aux::nested_type_wknd<meta_func<mpl_::arg<1> > >’
> ../boost/boost_1_51_0/boost/mpl/not.hpp:39:8: required from ‘struct
> boost::mpl::not_<meta_func<mpl_::arg<1> > >’
>
> ../boost/boost_1_51_0/boost/fusion/container/vector/detail/preprocessed/as_vector10.hpp:48:36:
> required from ‘static typename
> boost::fusion::detail::as_vector<2>::apply<I0>::type
> boost::fusion::detail::as_vector<2>::call(const Iterator&) [with
> Iterator =
> boost::fusion::filter_iterator<boost::fusion::forward_traversal_tag,
> boost::fusion::vector_iterator<const boost::fusion::vector<element,
> element>, 0>, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 2>,
> boost::mpl::not_<meta_func<mpl_::arg<1> > > >; typename
> boost::fusion::detail::as_vector<2>::apply<I0>::type =
> boost::fusion::vector2<element, element>]’
> ../boost/boost_1_51_0/boost/fusion/container/vector/convert.hpp:43:44:
> required from ‘typename boost::fusion::result_of::as_vector<const
> Sequence>::type boost::fusion::as_vector(const Sequence&) [with
> Sequence = boost::fusion::filter_view<const
> boost::fusion::vector<element, element>,
> boost::mpl::not_<meta_func<mpl_::arg<1> > > >; typename
> boost::fusion::result_of::as_vector<const Sequence>::type =
> boost::fusion::vector2<element, element>]’
> main.cpp:22:62: required from here
> main.cpp:16:28: error: no type named ‘type’ in ‘struct mpl_::arg<1>’
> In file included from ../boost/boost_1_51_0/boost/mpl/is_sequence.hpp:17:0,
> from
> ../boost/boost_1_51_0/boost/fusion/support/detail/is_mpl_sequence.hpp:12,
> from
> ../boost/boost_1_51_0/boost/fusion/support/tag_of.hpp:13,
> from
> ../boost/boost_1_51_0/boost/fusion/iterator/next.hpp:10,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/vector10.hpp:13,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/vector_fwd.hpp:14,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/vector.hpp:10,
> from
>
> ../boost/boost_1_51_0/boost/fusion/container/vector/detail/as_vector.hpp:18,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/convert.hpp:10,
> from
> ../boost/boost_1_51_0/boost/fusion/include/as_vector.hpp:10,
> from main.cpp:2:
> ../boost/boost_1_51_0/boost/mpl/not.hpp: In instantiation of ‘struct
> boost::mpl::not_<meta_func<mpl_::arg<1> > >’:
>
> ../boost/boost_1_51_0/boost/fusion/container/vector/detail/preprocessed/as_vector10.hpp:48:36:
> required from ‘static typename
> boost::fusion::detail::as_vector<2>::apply<I0>::type
> boost::fusion::detail::as_vector<2>::call(const Iterator&) [with
> Iterator =
> boost::fusion::filter_iterator<boost::fusion::forward_traversal_tag,
> boost::fusion::vector_iterator<const boost::fusion::vector<element,
> element>, 0>, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 2>,
> boost::mpl::not_<meta_func<mpl_::arg<1> > > >; typename
> boost::fusion::detail::as_vector<2>::apply<I0>::type =
> boost::fusion::vector2<element, element>]’
> ../boost/boost_1_51_0/boost/fusion/container/vector/convert.hpp:43:44:
> required from ‘typename boost::fusion::result_of::as_vector<const
> Sequence>::type boost::fusion::as_vector(const Sequence&) [with
> Sequence = boost::fusion::filter_view<const
> boost::fusion::vector<element, element>,
> boost::mpl::not_<meta_func<mpl_::arg<1> > > >; typename
> boost::fusion::result_of::as_vector<const Sequence>::type =
> boost::fusion::vector2<element, element>]’
> main.cpp:22:62: required from here
> ../boost/boost_1_51_0/boost/mpl/not.hpp:39:8: error: ‘value’ is not a
> member of ‘boost::mpl::aux::nested_type_wknd<meta_func<mpl_::arg<1> >
> >’
>
>
> --
> -*- mode: compilation; default-directory: "~/dev/test/" -*-
> Compilation started at Mon Nov 12 15:09:15
>
> bjam -q -j8
> ...patience...
> ...found 584 targets...
> ...updating 2 targets...
> gcc.compile.c++ bin/gcc-4.7.2/debug/main.o
> In file included from ../boost/boost_1_51_0/boost/mpl/is_sequence.hpp:17:0,
> from
> ../boost/boost_1_51_0/boost/fusion/support/detail/is_mpl_sequence.hpp:12,
> from
> ../boost/boost_1_51_0/boost/fusion/support/tag_of.hpp:13,
> from
> ../boost/boost_1_51_0/boost/fusion/iterator/next.hpp:10,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/vector10.hpp:13,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/vector_fwd.hpp:14,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/vector.hpp:10,
> from
>
> ../boost/boost_1_51_0/boost/fusion/container/vector/detail/as_vector.hpp:18,
> from
> ../boost/boost_1_51_0/boost/fusion/container/vector/convert.hpp:10,
> from
> ../boost/boost_1_51_0/boost/fusion/include/as_vector.hpp:10,
> from main.cpp:2:
> ../boost/boost_1_51_0/boost/mpl/not.hpp: In instantiation of ‘struct
>
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> >’:
> ../boost/boost_1_51_0/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:36:8:
> required from ‘struct
>
> boost::mpl::apply_wrap1<boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> >, element>’
> ../boost/boost_1_51_0/boost/mpl/aux_/preprocessed/gcc/bind.hpp:144:21:
> required from ‘struct
>
> boost::mpl::bind1<boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> >,
> boost::mpl::bind1<boost::mpl::quote1<boost::fusion::result_of::value_of>,
> mpl_::arg<1> > >::apply<boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 0> >’
> ../boost/boost_1_51_0/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:36:8:
> required from ‘struct
>
> boost::mpl::apply_wrap1<boost::mpl::bind1<boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> >,
> boost::mpl::bind1<boost::mpl::quote1<boost::fusion::result_of::value_of>,
> mpl_::arg<1> > >, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 0> >’
> ../boost/boost_1_51_0/boost/mpl/aux_/preprocessed/gcc/apply.hpp:42:8:
> required from ‘struct
>
> boost::mpl::apply1<boost::mpl::bind1<boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> >,
> boost::mpl::bind1<boost::mpl::quote1<boost::fusion::result_of::value_of>,
> mpl_::arg<1> > >, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 0> >’
>
> ../boost/boost_1_51_0/boost/fusion/algorithm/query/detail/find_if.hpp:33:35:
> required from ‘struct
> boost::fusion::detail::apply_filter<boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 0>,
>
> boost::mpl::bind1<boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> >,
> boost::mpl::bind1<boost::mpl::quote1<boost::fusion::result_of::value_of>,
> mpl_::arg<1> > > >’
> ../boost/boost_1_51_0/boost/mpl/if.hpp:67:11: [ skipping 10
> instantiation contexts ]
> ../boost/boost_1_51_0/boost/fusion/support/tag_of.hpp:69:16:
> required from ‘struct
>
> boost::fusion::traits::tag_of<boost::fusion::filter_iterator<boost::fusion::forward_traversal_tag,
> boost::fusion::vector_iterator<const boost::fusion::vector<element,
> element>, 0>, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 2>,
>
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > >, void>’
> ../boost/boost_1_51_0/boost/fusion/support/tag_of.hpp:77:16:
> required from ‘struct
>
> boost::fusion::detail::tag_of<boost::fusion::filter_iterator<boost::fusion::forward_traversal_tag,
> boost::fusion::vector_iterator<const boost::fusion::vector<element,
> element>, 0>, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 2>,
>
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > > >’
> ../boost/boost_1_51_0/boost/fusion/iterator/distance.hpp:60:16:
> required from ‘struct
>
> boost::fusion::result_of::distance<boost::fusion::filter_iterator<boost::fusion::forward_traversal_tag,
> boost::fusion::vector_iterator<const boost::fusion::vector<element,
> element>, 0>, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 2>,
>
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > >,
> boost::fusion::filter_iterator<boost::fusion::forward_traversal_tag,
> boost::fusion::vector_iterator<const boost::fusion::vector<element,
> element>, 2>, boost::fusion::vector_iterator<const
> boost::fusion::vector<element, element>, 2>,
>
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > > >’
>
> ../boost/boost_1_51_0/boost/fusion/view/filter_view/detail/size_impl.hpp:27:20:
> required from ‘struct
>
> boost::fusion::extension::size_impl<boost::fusion::filter_view_tag>::apply<const
> boost::fusion::filter_view<const boost::fusion::vector<element,
> element>,
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > > >’
> ../boost/boost_1_51_0/boost/fusion/sequence/intrinsic/size.hpp:68:16:
> required from ‘struct boost::fusion::result_of::size<const
> boost::fusion::filter_view<const boost::fusion::vector<element,
> element>,
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > > >’
> ../boost/boost_1_51_0/boost/fusion/container/vector/convert.hpp:23:82:
> required from ‘struct boost::fusion::result_of::as_vector<const
> boost::fusion::filter_view<const boost::fusion::vector<element,
> element>,
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > > >’
> ../boost/boost_1_51_0/boost/fusion/container/vector/convert.hpp:40:5:
> required by substitution of ‘template<class Sequence> typename
> boost::fusion::result_of::as_vector<const Sequence>::type
> boost::fusion::as_vector(const Sequence&) [with Sequence =
> boost::fusion::filter_view<const boost::fusion::vector<element,
> element>,
> boost::mpl::not_<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> > >]’
> main.cpp:22:81: required from here
> ../boost/boost_1_51_0/boost/mpl/not.hpp:39:8: error: ‘value’ is not a
> member of
> ‘boost::mpl::aux::nested_type_wknd<boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<meta_func,
> mpl_::void_>, mpl_::arg<1> >, 0> >’
>
>
> Thanks in advance,
> --
> Felipe Magno de Almeida
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

- Jeff



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net