Boost logo

Boost Users :

From: Duane Murphy (duanemurphy_at_[hidden])
Date: 2004-12-18 13:08:13


Thanks Thorsten!

--- At Sat, 18 Dec 2004 12:10:03 +0100, Thorsten Ottosen wrote:

>"Duane Murphy" <duanemurphy_at_[hidden]> wrote in message
>news:20041218011734.1390_at_linux.murphyslogic.com...
>|I am changing a code base that previously was using the no longer
>| supported array_traits. I use the begin() and end() functions in a lot of
>| places with arrays of integers.
>|
>| I have converted everything to using boost::range::begin() and end().
>| However, there is a severe collision. begin() and more importantly end()
>| are overloaded for wchar_t. Turns out on Mac OS X, wchar_t is the same as
>| an int.
>
>I don't get it. wchar_t should be a distinct type, in particular *different*
>from int.
>What compiler are you using ?

I'm using CodeWarrior 8.3 on Mac OS X, but in a mode where I use the
Apple/gcc headers. wchar_t is #defined to be int (not even a typedef
which wouldn't help anyhow).

>| This causes end() to look for a null terminator instead of just
>| using the array length template function.
>|
>| Is there a way I can make range::end() work for real array's of int
>| rather than wchar_t?
>
>Its crappy, but boost::range_detail::array_end<int>( my_array )
>will pick the index based computation.

Thanks, I kind of came up with that also. I'm going to put a new function
in a different namespace that will only forward to this interface.

 ...Duane


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net