fork download
  1. #include <iostream>
  2. template<class seq,class list>
  3. struct mylambda
  4. {
  5. seq& s;
  6. size_t I =0;
  7. constexpr mylambda(seq& s):s(s){}
  8. template<class T>
  9. constexpr void operator()(T&& tuple_element)
  10. {
  11. tuple_element= {boost::fusion::at_c<I>(s),boost::mp11::mp_at_c<list,I>()};
  12. I++;
  13. }
  14. };
  15. template<class TaggedType, class Tag1>
  16. using TagView = tag_view<TaggedType,Tag1>;
  17.  
  18. template<class seq, typename ...list>
  19. constexpr auto create_tag_views( seq& s, list&&... )
  20. {
  21. // boost::mp11::mp_list<tag_view<n1,n1>,tag_view<n2,n2>>
  22. using R = typename boost::mp11::mp_product<TagView,mp_mpl_sequence<seq>,boost::mp11::mp_list<list...>>;
  23. // std::tuple<tag_view<n1,n1>,tag_view<n2,n2>>
  24. using Tuple = typename boost::mp11::mp_rename<R,std::tuple>;
  25. constexpr Tuple tuple;
  26. using taglist = boost::mp11::mp_list<list...>;
  27. //constexpr size_t I = 0;
  28. //constexpr size_t size = boost::mp11::mp_size<taglist>::value;
  29. boost::mp11::tuple_for_each(tuple, mylambda<seq,taglist>{s}
  30. /*[&]( auto& tuple_element ){
  31.   tuple_element= {boost::fusion::at_c<I>(s),boost::mp11::mp_at_c<taglist,I>()};
  32.   //I++;//no const expr lambda :/
  33.   }//*/
  34. );
  35. return tuple;
  36. }
  37.  
  38. using namespace std;
  39.  
  40. int main() {
  41. // your code goes here
  42. return 0;
  43. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘constexpr void mylambda<seq, list>::operator()(T&&)’:
prog.cpp:11:25: error: ‘boost’ has not been declared
         tuple_element= {boost::fusion::at_c<I>(s),boost::mp11::mp_at_c<list,I>()};
                         ^~~~~
prog.cpp:11:51: error: ‘boost’ has not been declared
         tuple_element= {boost::fusion::at_c<I>(s),boost::mp11::mp_at_c<list,I>()};
                                                   ^~~~~
prog.cpp:11:76: error: expected primary-expression before ‘,’ token
         tuple_element= {boost::fusion::at_c<I>(s),boost::mp11::mp_at_c<list,I>()};
                                                                            ^
prog.cpp:11:80: error: expected primary-expression before ‘)’ token
         tuple_element= {boost::fusion::at_c<I>(s),boost::mp11::mp_at_c<list,I>()};
                                                                                ^
prog.cpp: At global scope:
prog.cpp:16:17: error: ‘tag_view’ does not name a type
 using TagView = tag_view<TaggedType,Tag1>;
                 ^~~~~~~~
prog.cpp: In function ‘constexpr auto create_tag_views(seq&, list&& ...)’:
prog.cpp:22:24: error: ‘boost’ has not been declared
     using R = typename boost::mp11::mp_product<TagView,mp_mpl_sequence<seq>,boost::mp11::mp_list<list...>>;
                        ^~~~~
prog.cpp:24:28: error: ‘boost’ has not been declared
     using Tuple = typename boost::mp11::mp_rename<R,std::tuple>;
                            ^~~~~
prog.cpp:25:15: error: ‘Tuple’ does not name a type
     constexpr Tuple tuple;
               ^~~~~
prog.cpp:26:21: error: ‘boost’ does not name a type
     using taglist = boost::mp11::mp_list<list...>;
                     ^~~~~
prog.cpp:29:5: error: ‘boost’ has not been declared
     boost::mp11::tuple_for_each(tuple, mylambda<seq,taglist>{s}
     ^~~~~
prog.cpp:29:33: error: ‘tuple’ was not declared in this scope
     boost::mp11::tuple_for_each(tuple, mylambda<seq,taglist>{s}
                                 ^~~~~
prog.cpp:29:33: note: suggested alternative:
In file included from /usr/include/c++/6/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/6/bits/char_traits.h:39,
                 from /usr/include/c++/6/ios:40,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from prog.cpp:1:
/usr/include/c++/6/bits/stl_pair.h:83:11: note:   ‘std::tuple’
     class tuple;
           ^~~~~
prog.cpp:29:53: error: ‘taglist’ was not declared in this scope
     boost::mp11::tuple_for_each(tuple, mylambda<seq,taglist>{s}
                                                     ^~~~~~~
prog.cpp:29:60: error: template argument 2 is invalid
     boost::mp11::tuple_for_each(tuple, mylambda<seq,taglist>{s}
                                                            ^
stdout
Standard output is empty