# Boost.MultiIndex Compiler specifics

Key extraction
Index
Performance

Boost.MultiIndex has been tried in different compilers, with various degrees of success. We list the limitations encountered, along with suitable workarounds when available. Up to date information on compatibility of Boost.MultiIndex with several compilers can be found at the Boost Compiler Status Summary. Take into account, however, that between releases of Boost the results from these automatic tests can reflect spurious errors due to work in progress, and may not serve as an accurate indication of which compilers are actually supported.

## Contents

- Borland C++ Builder 6.4
- Comeau C/C++ 4.3.3 for Windows (VC++ 7.0/7.1 backend)
- Compaq C++ 6.5-041 for Tru64 UNIX
- GNU GCC 3.2 and later
  - GNU GCC for Tru64 UNIX
- IBM VisualAge C++ V6.0 for AIX
- Intel C++ Compiler for Linux 7.1/8.0/8.1
- Intel C++ Compiler for Windows 32-bit 7.0/7.1
- Intel C++ Compiler for Windows 32-bit 7.1 + STLport 4.5.3
- Intel C++ Compiler for Windows 32-bit 8.0/8.1
- Metrowerks CodeWarrior 8.3/9.2/9.3
- Microsoft Visual C++ 6.0 Service Pack 5
- Microsoft Visual C++ 6.0 Service Pack 5 + STLport 4.5.3
- Microsoft Visual C++ 7.0
- Microsoft Visual C++ 7.1
- Microsoft Visual C++ 8.0

## Borland C++ Builder 6.4

Currently, Boost.MultiIndex cannot be used with BCB 6.4. The number of problems encountered during the tests makes it unlikely that future versions of the library can be made to work under this compiler.

## Comeau C/C++ 4.3.3 for Windows (VC++ 7.0/7.1 backend)

No problems have been detected with this compiler. The library fails to compile, however, when Microsoft Visual C++ 6.0 is used as the backend.

## Compaq C++ 6.5-041 for Tru64 UNIX

No problems have been detected with this compiler.

## GNU GCC 3.2 and later

No problems have been detected with several versions of this compiler starting from 3.2. The following versions have been explicitly tested:

- GCC 3.2 20020927 (prerelease) under Cygwin 1.5.7,
- GCC 3.2.3 under Linux,
- GCC 3.3 20030304 under Mac OS,
- GCC 3.3.1 (cygming special) under Cygwin 1.5.7, (mingw special 20030804-1) under Win32
- GCC 3.3.2 under Linux,
- GCC 3.3.3 under Linux,
- GCC 3.4.0 under Linux and Solaris,
- GCC 3.4.1 under HP-UX and Linux,
- GCC 3.4.2 under Linux and Tru64 (see below), (mingw-special) under Win32.

Boost.MultiIndex does not work with versions 3.1 and prior of GCC.

### GNU GCC for Tru64 UNIX

On this platform, GCC is not able to handle debug symbol names whose length exceeds 32,768 bytes, resulting in the error `mips-tfile, ... string too big`. You may encounter this issue with heavily templatized code like Boost.MultiIndex, which typically produces long symbol names. The problem can be overcome by omitting the compiler option `-g` (generate debugging information.) Alternatively, you can restrict the maximum number of elements accepted by `indexed_by`, `tag` and `composite_key` by globally setting the values of the macros

- `BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE` (default: 20),
- `BOOST_MULTI_INDEX_LIMIT_TAG_SIZE` (default: 20),
- `BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE` (default: 10).

This operation results in a modest reduction of the lengths of symbol names.

## IBM VisualAge C++ V6.0 for AIX

`member` not supported, replace with `member_offset` or use the cross-platform macro `BOOST_MULTI_INDEX_MEMBER`. The compiler emits warnings about the use of `offsetof` with non-POD types: these warnings can be suppressed by setting the compiler option `-qsuppress=1540-1281`, or, alternatively, by inserting the following preprocessor directive:

>     #pragma info(nolan)

This latter pragma, however, may also eliminate other warnings not related to the use of `offsetof`.

## Intel C++ Compiler for Linux 7.1/8.0/8.1

No problems have been detected with these compilers.

## Intel C++ Compiler for Windows 32-bit 7.0/7.1

`member` not supported, replace with `member_offset` or use the cross-platform macro `BOOST_MULTI_INDEX_MEMBER`.

Altough Koenig lookup seems to be officially supported by this compiler, some issues have arisen seemingly due to bugs related to this facility. In these cases you might need to explicitly qualify global names with `::boost::multi_index`.

## Intel C++ Compiler for Windows 32-bit 7.1 + STLport 4.5.3

Boost.MultiIndex works for this configuration. The same limitations apply as in Intel C++ 7.1 with its original Dinkumware standard library. STLport 4.6.2 has also been confirmed to work correctly.

## Intel C++ Compiler for Windows 32-bit 8.0/8.1

No problems have been detected with these compilers.

## Metrowerks CodeWarrior 8.3/9.2/9.3

Boost.MultiIndex works correctly with these versions of the compiler, under the two operating systems tested: Mac OS and Windows.

## Microsoft Visual C++ 6.0 Service Pack 5

`member` not supported, replace with `member_offset` or use the cross-platform macro `BOOST_MULTI_INDEX_MEMBER`.

`const_mem_fun` not supported, replace with `const_mem_fun_explicit` or use the cross-platform macro `BOOST_MULTI_INDEX_CONST_MEM_FUN`.

`mem_fun` is not supported, replace with `mem_fun_explicit` or use the cross-platform macro `BOOST_MULTI_INDEX_MEM_FUN`.

No support for index retrieval and projection nested types and member functions:

- `nth_index`,
- `index`,
- `nth_index_iterator`,
- `nth_index_const_iterator`,
- `index_iterator`,
- `index_const_iterator`,
- `get`,
- `project`.

You can use instead their global equivalents. Also, this compiler does not implement Koenig lookup, so you might need to explicitly qualify these global names with `::boost::multi_index`.

The lack of partial template specialization support in MSVC++ 6.0 results in some inconveniences when using `composite_key` that can be remedied as explained in "`composite_key` in compilers without partial template specialization" on the advanced topics section.

MSVC++ 6.0 presents serious limitations for the maximum length of symbol names generated by the compiler, which might result in the linker error `LNK1179: invalid or corrupt file: duplicate comdat comdat`. To overcome this problem, you can restrict the maximum number of elements accepted by `indexed_by`, `tag` and `composite_key` by globally setting the values of the macros

- `BOOST_MULTI_INDEX_LIMIT_INDEXED_BY_SIZE` (default in MSVC++ 6.0: 5),
- `BOOST_MULTI_INDEX_LIMIT_TAG_SIZE` (default in MSVC++ 6.0: 3),
- `BOOST_MULTI_INDEX_LIMIT_COMPOSITE_KEY_SIZE` (default in MSVC++ 6.0: 5).

This operation results in a modest reduction of the lengths of symbol names.

Under some circumstances, the compiler emits the error `C2587``: '_U' : illegal use of local variable as default parameter`, inside the MSVC internal header `<xlocnum>`. This problem is a recurrent bug of the compiler, and has been reported in other unrelated libraries, like the Boost Graph Library, Boost.MultiArray, Boost.Regex, CGAL and MySQL++. The error is triggered, though not in a systematic manner, by the use of `multi_index_container` iterator constructor. Two workarounds exist: the first consists of avoiding this constructor and replacing code like:

>     multi_index_container<...> s(c.begin(),c.end());

with equivalent operations:

>     multi_index_container<...> s;
>     s.insert(c.begin(),c.end());

The second workaround has not been confirmed by the author, but it is given on the Internet in connection with this error appearing in other libraries. Replace line 84 of `<xlocnum>`

>      #define _VIRTUAL	virtual

with the following:

>      #define _VIRTUAL

Warning: it is not known whether this replacement can result in unexpected side effects in code implicitly using `<xlocnum>`.

In general, the extensive use of templates by Boost.MultiIndex puts this compiler under severe stress, so that several internal limitations may be reached. The following measures can help alleviate these problems:

- Set the compiler option `/Zm` (Specify Memory Allocation Limit) to increase the amount of memory available for compilation. Usual values for this option range from 300 to 800.
- If in debug mode, try switching from `/ZI` (Program Database for Edit and Continue) to a less demanding type of debugging information (`/Zi`, `/Z7` or `/Zd`.)
- Play with the precompiled headers options. Usually, turning this feature off yields the best results.
- If the compiler emits the error `C1055``: compiler limit : out of keys`, try disabling the option `/Gm` (Enable Minimal Rebuild.) In these cases, it is also beneficial to split the project into smaller subprojects.

## Microsoft Visual C++ 6.0 Service Pack 5 + STLport 4.5.3

Boost.MultiIndex works for this configuration. The same limitations apply as in MSVC++ 6.0 with its original Dinkumware standard library. STLport 4.6.2 has also been confirmed to work correctly.

## Microsoft Visual C++ 7.0

`member` not supported, replace with `member_offset` or use the cross-platform macro `BOOST_MULTI_INDEX_MEMBER`.

No support for index retrieval and projection nested types and member functions:

- `nth_index`,
- `index`,
- `nth_index_iterator`,
- `nth_index_const_iterator`,
- `index_iterator`,
- `index_const_iterator`,
- `get`,
- `project`.

You can use instead their global equivalents. Also, this compiler does not implement Koenig lookup, so you might need to explicitly qualify these global names with `::boost::multi_index`.

The lack of partial template specialization support in MSVC++ 7.0 results in some inconveniences when using `composite_key` that can be remedied as explained in "`composite_key` in compilers without partial template specialization" on the advanced topics section.

## Microsoft Visual C++ 7.1

Problems have been reported when compiling the library with the `/Gm` option (Enable Minimal Rebuild.) Seemingly, this is due to an internal defect of the compiler (see for instance this mention of a similar issue in the Boost Users mailing list.) If `/Gm` is turned off, Boost.MultiIndex compiles and runs without further problems.

## Microsoft Visual C++ 8.0

No problems have been detected with this compiler. The Beta 1 version of this product was used for the testing.

Key extraction
Index
Performance

Revised October 18th 2004

© Copyright 2003-2004 Joaquín M López Muñoz. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)