concatenate boost::mpl::string


How I can concatenate boost::mpl::string? The following code produce errors:

#include <iostream> #include <boost/mpl/vector.hpp> #include <boost/mpl/string.hpp> #include <boost/mpl/fold.hpp> #include <boost/mpl/placeholders.hpp> #include <boost/mpl/push_back.hpp> typedef boost::mpl::vector< boost::mpl::string<'ab'>, boost::mpl::string<'cd'>, boost::mpl::string<'ef'> > slist; typedef boost::mpl::fold< slist, boost::mpl::string<>, boost::mpl::push_back<boost::mpl::_1, boost::mpl::_2> >::type string; int main() { std::cout << boost::mpl::c_str<string>::value << std::endl; }

full source here: <a href="http://liveworkspace.org/code/31902a4b1b0831d054119bc0b8923cb6" rel="nofollow">http://liveworkspace.org/code/31902a4b1b0831d054119bc0b8923cb6</a> errors:


In file included from source.cpp:3:0: string.hpp: In instantiation of 'boost::mpl::push_back_impl< boost::mpl::string_tag


::apply, boost::mpl::string<24930> >': boost/mpl/push_back.hpp:32:1:<br /> instantiated from 'boost::mpl::push_back< boost::mpl::string<>, boost::mpl::string<24930> ' boost/mpl/aux_/has_type.hpp:20:1:<br /> instantiated from 'const bool boost::mpl::aux::has_type< boost::mpl::push_back, boost::mpl::string<24930> >, mpl_::bool_ ::value' boost/mpl/aux_/has_type.hpp:20:1:<br /> instantiated from 'boost::mpl::aux::has_type< boost::mpl::push_back, boost::mpl::string<24930> >, mpl_::bool_ ' boost/mpl/aux_/preprocessed/gcc/quote.hpp:56:5: instantiated from 'boost::mpl::quote2< boost::mpl::push_back ::apply, boost::mpl::string<24930> >' boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:49:1: instantiated from 'boost::mpl::apply_wrap2< boost::mpl::quote2, boost::mpl::string<>, boost::mpl::string<24930> ' boost/mpl/aux_/preprocessed/gcc/bind.hpp:207:21: instantiated from 'boost::mpl::bind2< boost::mpl::quote2, mpl_::arg<1>, mpl_::arg<2> ::apply, boost::mpl::string<24930> >' boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp:49:1: instantiated from 'boost::mpl::apply_wrap2< boost::mpl::protect< boost::mpl::bind2, mpl_::arg<1>, mpl_::arg<2> >, 0 , boost::mpl::string<>, boost::mpl::string<24930> ' boost/mpl/aux_/preprocessed/gcc/apply.hpp:73:1: instantiated from 'boost::mpl::apply2< boost::mpl::push_back, mpl_::arg<2> >, boost::mpl::string<>, boost::mpl::string<24930> ' boost/mpl/aux_/preprocessed/gcc/fold_impl.hpp:87:85: instantiated from 'boost::mpl::aux::fold_impl< 3, boost::mpl::v_iter< boost::mpl::vector, boost::mpl::string<25444>, boost::mpl::string<25958> >, 0l , boost::mpl::v_iter< boost::mpl::vector, boost::mpl::string<25444>, boost::mpl::string<25958> >, 3l , boost::mpl::string<>, boost::mpl::push_back, mpl_::arg<2> > ' boost/mpl/fold.hpp:39:18: instantiated from 'boost::mpl::fold< boost::mpl::vector, boost::mpl::string<25444>, boost::mpl::string<25958> > , boost::mpl::string<>, boost::mpl::push_back, mpl_::arg<2> > ' source.cpp:18:2: instantiated from here string.hpp:207:53: error: 'value' is not a member of 'boost::mpl::string<24930>' In file included from boost/mpl/back_inserter.hpp:18:0, from boost/mpl/aux_/inserter_algorithm.hpp:18, from boost/mpl/copy.hpp:20, from string.hpp:26, from source.cpp:3: boost/mpl/push_back.hpp: In instantiation of 'boost::mpl::push_back< boost::mpl::push_back, boost::mpl::string<24930> >, boost::mpl::string<25444> ': boost/mpl/aux_/has_type.hpp:20:1:<br /> instantiated from 'const bool boost::mpl::aux::has_type< boost::mpl::push_back< boost::mpl::push_back, boost::mpl::string<24930> >, boost::mpl::string<25444> , mpl_::bool_ ::value' boost/mpl/aux_/has_type.hpp:20:1:<br /> instantiated from 'boost::mpl::aux::has_type< boost::mpl::push_back< boost::mpl::push_back, boost::mpl::string<24930> >, boost::mpl::string<25444> , mpl_::bool_ ' boost/mpl/aux_/preprocessed/gcc/quote.hpp:56:5: instantiated from 'boost::mpl::quote2< boost::mpl::push_back

</blockquote> </blockquote>


#include <iostream> #include <boost/mpl/vector.hpp> #include <boost/mpl/string.hpp> #include <boost/mpl/fold.hpp> #include <boost/mpl/front.hpp> #include <boost/mpl/deref.hpp> #include <boost/mpl/placeholders.hpp> #include <boost/mpl/push_back.hpp> using namespace boost; typedef boost::mpl::vector< boost::mpl::string<'a','b'>, boost::mpl::string<'c','d'>, boost::mpl::string<'e','f'> > slist; typedef boost::mpl::reverse_fold< slist, mpl::string<>, boost::mpl::copy<mpl::_1, mpl::back_inserter<mpl::_2> > >::type string; int main() { std::cout << boost::mpl::c_str<string>::value << std::endl; }


//it's very easy to do this to have the same out put: abcdef #include <boost/mpl/string.hpp> #include <iostream> typedef mpl::string<'ab','cd','ef'> string; int main() { std::cout << mpl::c_str<string>::value << std::endl; }


  • Getting strings from a list into VID in Red language
  • Thread memory usage keeps increasing
  • Mongodb: compute a value before using it as connectFromField in an aggregate
  • How to determine if an array has consecutive integers and if so, how many?
  • Scala: How to merge lists by the first element of the tuple
  • why is the sort() not working?
  • parse json list in reverse order
  • Sending a C# string as an argument to a unmanaged C++ DLL function
  • Spark DataFrame equivalent to Pandas Dataframe `.iloc()` method?
  • Firebase Authentication Javascript: setCookie for pending Credential for redirect
  • C/C++ System portable way to change maximum number of open files
  • Is it possible to refresh a div on a radio button click?
  • Cannot use Turkish characters with Entity Framework
  • What is #:: method
  • jaxb xsd prefix package names
  • C++ Text File Reading
  • python - terminate child process when script invoked from bash
  • How to autoplay video in angularjs?
  • Entity Framework Core 1.0.1 add-migration
  • What's the essential difference between these two variadic functions?
  • std::system Exception when instantiating a singleton object
  • runtime-check whether an instance (Base*) override a parent function (Base::f())
  • c++ regex_replace not doing intended substitution
  • Building Qt project for C++11 standard
  • C++ friend class std::vector
  • Error in installing package: fatal error: stdlib.h: no such file or directory
  • Reduction and collapse clauses in OMP have some confusing points
  • C++ and preprocessor macros: variadic type
  • output of program is not same as passed argument
  • Akka Routing: Reply's send to router ends up as dead letters
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How do I configure my settings file to work with unit tests?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • unknown Exception android
  • Checking variable from a different class in C#
  • Sorting a 2D array using the second column C++
  • Binding checkboxes to object values in AngularJs
  • java string with new operator and a literal