Boost logo

Boost :

From: HartmutKaiser_at_[hidden]
Date: 2001-12-09 13:00:00


Hi all,

We at the Spirit development group
(http://sourceforge.net/projects/spirit/) use the Boost.Tuple library as
a base for implementing parser closures. Since Spirit is a header only
C++ library we had the problem, that we couldn't use the tuple_io
functionality as it is.

The Boost.Tuple library requires a static constant variable definition
(format_info::stream_index, see file boost/libs/tuple/src/tuple.cpp) to
be linked to the built executable. To overcome this incompatibility with
our design rules (headers only) I want to propose the following change
(reference is the current CVS):

File boost/tuple/tuple_io.hpp:

52c52,58
< static const int stream_index[number_of_manipulators];

---
>    static int get_stream_index (int m)
>    {
>    static const int stream_index[number_of_manipulators]
>         = { std::ios::xalloc(), std::ios::xalloc(), std::ios::xalloc()
};
>
>         return stream_index[m];
>    }
61c67
<      char c = static_cast<char>(i.iword(stream_index[m]));
---
>      char c = static_cast<char>(i.iword(get_stream_index(m)));
75c81
<       i.iword(stream_index[m]) = static_cast<long>(c);
---
>       i.iword(get_stream_index(m)) = static_cast<long>(c);
85c91
<      CharType c = static_cast<CharType>(i.iword(stream_index[m]) );
---
>      CharType c = static_cast<CharType>(i.iword(get_stream_index(m))
);
105c111
<       i.iword(stream_index[m]) = static_cast<long>(c);
---
>       i.iword(get_stream_index(m)) = static_cast<long>(c);
This removes the need for a separate file to link with the executable
using the Boost.Tuple library.
Regards Hartmut

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