Boost logo

Boost :

Subject: [boost] [MultiIndex] interface comments
From: David Abrahams (dave_at_[hidden])
Date: 2008-10-31 15:45:06


Just reading through the docs for this very useful library and I had a
few notes:

0. The term /typelist/ (italicized) is used in the tutorial without
   definition. Do you mean an MPL type sequence, or something else?

1. Seems like the tags functionality could take advantage of Boost.Parameter
   to provide a nicer interface and save some code.

2. The "shortcuts" save exactly 1 character.

      Each index of a multi_index_container uses its own iterator types,
      which are different from those of another indices. As is the rule
      with STL containers, these iterators are defined as nested types
      of the index:

          employee_set::nth_index<1>::type::iterator it=
            es.get<1>().find("Judy Smith");

      <snip>

      Additionally, multi_index_containers provide shortcut definitions
      to the iterator types of their constituent indices:

          employee_set::nth_index_iterator<1>::type it=
            es.get<1>().find("Judy Smith");

      There is a variation of the expression above for use with tags:

          employee_set::index_iterator<name>::type it=
            es.get<name>().find("Judy Smith"); // get<1> would also work

   
   Notice the column in which "it" appears in both versions. IMO these
   interfaces should be deprecated (i.e. not documented, and eventually
   removed) as they provide no readability advantage, hurt learnability,
   and complicate usage.

Regards,

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk