Next: , Previous: C++ Union, Up: C++ mappings


6.2.9 Mapping for sequence types

GenoM IDL sequences mapping differ for bounded or unbouded variations of the sequence. The bounded sequences maps onto the std::vector template class provided by the C++ standard. The unbounded sequence maps onto a C++ std::tr1::array template class. The definition of std::tr1::array is not provided by the C++ standard, but is commonly implemented by modern C++ compiler as a transition step toward the C++11 standard.

For instance, the following IDL:

      typedef sequence<long> unbounded;
      typedef sequence<long,16> bounded;

would map into

      typedef std::vector<int32_t> unbounded;
      typedef std::tr1::array<int32_t, 16> bounded;

At the time of writing, std::array is still not officially supported by most compilers and available only as an experimental extension, so it has been decided to not use it. As soon as most compilers will provide an official implementation of std::array, this type will be used instead of std::tr1::array. Since the differences between the two interfaces are minimal, this should have only little impact on existing code.