Boost logo

Boost Users :

Subject: Re: [Boost-users] [Mpl, Fusion] using adapted struct with mpl algorithms
From: Paul Graphov (graphov_at_[hidden])
Date: 2010-09-17 05:33:11


SOLVED!

boost::fusion::result_of::as_vector solved my problem.

Thanks.

On 17 September 2010 12:03, Paul Graphov <graphov_at_[hidden]> wrote:

> Hello Boost Users,
>
> I've encountered a trouble using fusion adapted struct as mpl sequence:
> when I call mpl::push_front with fusion::vector it works but if I try to
> call it with
> adapted struct, it fails. Do I miss something? Is there any concise
> solution or
> I have to convert it by hand?
>
> source:
>
> http://pastebin.com/3ELipu1M
>
>
> 1. #include <string>
> 2.
> 3. #include <boost/fusion/adapted/struct/adapt_struct.hpp>
> 4. #include <boost/fusion/mpl.hpp>
> 5. #include <boost/fusion/container/vector.hpp>
> 6. #include <boost/mpl/push_front.hpp>
> 7.
> 8. typedef boost::fusion::vector<std::string, int> employee_1;
> 9.
> 10. struct employee_2
> 11. {
> 12. std::string name;
> 13. int age;
> 14. };
> 15.
> 16. BOOST_FUSION_ADAPT_STRUCT(
> 17. employee_2,
> 18. (std::string, name)
> 19. (int, age))
> 20.
> 21. /* this line compiles just fine */
> 22. typedef boost::mpl::push_front<employee_1, bool>::typebool_employee_1
> ;
> 23.
> 24. /* this fails */
> 25. typedef boost::mpl::push_front<employee_2, bool>::typebool_employee_2
> ;
> 26.
> 27. int main() {
> 28. return 0;
> 29. }
>
>
> Thanks!
>



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