Hello world!

Yes, you can.

#include <boost/mpl/string.hpp>
#include <boost/mpl/insert.hpp>
#include <boost/mpl/end.hpp>

namespace mpl = boost::mpl;

template < typename S1, typename S2 >
struct concat 
  : mpl::insert
    <
      S1
    , typename mpl::end<S1>::type
    , S2
    > 
{};

typedef mpl::string<'hell', 'o'> hello;
typedef mpl::string<'worl', 'd!'> world;

typedef concat
< 
  concat
  <
    hello
  , mpl::string<' '> 
  >::type
  , world
>::type because_i_can;

#include <iostream>
int main()
{
  std::cout << mpl::c_str<because_i_can>::value << std::endl;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: