From: Peder Holt (peder.holt_at_[hidden])
Date: 2004-09-02 05:44:59
On Thu, 02 Sep 2004 10:43:36 +0100, Daniel James <daniel_at_[hidden]> wrote:
> I've been trying out your new version, and I found that it was fairly
> easy to run out of indicies when using it repeatedy. Looking at the
> code, I think it should be possible to only generate one value per
> encoding. Basically my idea is that instead of using:
> friend sizer<VOLATILE> encode_value(encode_counter<Index>*);
> You could use:
> template<unsigned EncodingId, unsigned Index = 0>
> struct value_pair
> typedef value_pair<EncodingId, Index+1> next;
> friend sizer<VOLATILE> encode_value(value_pair<EncodingId, Index>*);
> The existing compile time variable mechanism would just be used to
> generate the increasing EncodingId's - one per typedef. I included the
> next member so that the value_pair could be passed by type, replacing
> the existing Index parameter. Then whenever you currently use Index+1,
> you can use 'typename ValuePair::next'.
> I guess this is a little obvious, so sorry if you're already doing
> something like it. If it doesn't make sense I can put together an
In the current version of typeof that you have, I made a very quick
and dirty workaround for a MSVC ETI problem.
The problem arose from typeof being used inside a template class, and
caused the starting index values to be garbled.
As a quick workaround, every time BOOST_TYPEOF is used, the index is
incremented by 100, meaning you can only use BOOST_TYPEOF 10 times
(with the current BOOST_MAX_TYPEOF_COUNTER)
When I analyzed the problem later, I discovered that all that is
needed is to set the starting index to 100, and the problem goes away.
I fixed the problem and resubmitted it to boost/files.
In this implementation, the index is greedy, meaning that a type with
depth of 2 will only occupy 2 indices.
If you still encounter problems, try to increase BOOST_MAX_TYPEOF_COUNTER
I also made some additional fixes to make typeof compile in release (VC 6.5)
(Requires Multithreaded DLL compile condition in order to not ICE...)
Good luck. Thank you for the feedback.
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk