Boost logo

Boost :

Subject: [boost] [multi_index] feature proposal: member keys and typeless specification of keys
From: JOAQUIN M. LOPEZ MUÑOZ (joaquin_at_[hidden])
Date: 2011-05-08 07:31:32

Hi all,

This is a proposal for inclusion of two new features into Boost.MultiIndex,

Consider the following:

  struct foo


    int x;

    int bar();

    int baz()const;


  typedef multi_index_container<



      ordered_unique<member<foo,int,&foo::x> >,

      ordered_unique<mem_fun<foo,int,&foo::bar> >,

      ordered_unique<const_mem_fun<foo,int,&foo::baz> >


> multi_t;

Note that we have to use member, mem_fun or const_mem_fun

depending on the kind of key used. mem_key allows for a uniform

specification syntax:

  typedef multi_index_container<



      ordered_unique<mem_key<int foo::*,&foo::x> >,

      ordered_unique<mem_key<int (foo::*)(),&foo::bar> >,

      ordered_unique<mem_key<int (foo::*)()const,&foo::baz> >


> multi_t;

This in itself gains us relatively little; but if we have a C++11 compiler

with decltype, BOOST_MULTI_INDEX_AUTO_KEY can use mem_key

in a way that dispenses with the need for specifying the type of

the key!

  typedef multi_index_container<







> multi_t;

Some requests and questions:

1. If you're interested in these features, please download the attached

mem_key.hpp file, play with it and report on successful/problematic


2. Do you think this is worth including in Boost.MultiIndex?

3. Proposals on the naming scheme?

Thank you,

Joaquín M López Muñoz

Telefónica, Investigación y Desarrollo

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at.

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