Boost logo

Boost :

Subject: Re: [boost] [TypeSort] Automatic type sorting
From: Eric Niebler (eniebler_at_[hidden])
Date: 2015-03-21 21:31:51

On 3/20/2015 11:44 AM, Louis Dionne wrote:
> As a simple curiosity, here's how this could be implemented with Hana:

And using Meta:

#include <tuple>
#include <meta/meta.hpp>

using namespace meta;
namespace l = lazy;

template<typename List>
using indexed_sort_ = sort<zip<

template<typename List>
using indexed_sort =

int main()
  using P =
  using Tup = apply_list<quote<std::tuple>, first<P>>;
  using Idx = second<P>;
    // list<int_<2>,int_<1>,int_<4>,int_<0>,int_<3>>

  Tup tup; // std::tuple<char[1],char[2],...char[5]>
  char(&a)[3] = std::get<at_c<Idx, 0>::value>(tup);
  char(&b)[2] = std::get<at_c<Idx, 1>::value>(tup);
  char(&c)[5] = std::get<at_c<Idx, 2>::value>(tup);

FWIW, these indices don't seem all that useful to me. What exactly was
the desired behavior?

Eric Niebler

Boost list run by bdawes at, gregod at, cpdaniel at, john at