Integral Sequence Wrappers

Integral Sequence Wrappers

We've already discussed the use of the vector_c class template as a shortcut for writing lists of integral constants. MPL also supplies list_c, deque_c, and set_c for representing the corresponding vectors, deques, and sets. Each of these sequences takes the form:

    sequence-type_c<T, n1, n2, ... nk>

The first argument to each of these sequence wrappers is the integer type T that it will store, and the following arguments are the values of T that it will store. You can think of these as being equivalent to:

      , integral_c<T,n2>
      , ...
      , integral_c<T,nk>

That said, they are not precisely the same type, and, as we've suggested, you should not rely on type identity when comparing sequences.

Note that the MPL also provides _c-suffixed versions of the numbered sequence forms:

    #include <boost/mpl/vector/vector10_c.hpp>

    typedef boost::mpl::vector10_c<int,1,2,3,4,5,6,7,8,9,10> v10;

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows