|
Boost : |
Subject: [boost] [Survey] utf8_codecvt_facet::do_length parameter
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2012-06-28 11:30:14
There's some confusion in boost (and in various standard libraries) as to the declaration of
std::codecvt<>::do_length
The '03 and '11 standards say:
> template <class internT, class externT, class stateT>
> class codecvt : public locale::facet, public codecvt_base {
> // blah blah blah
> virtual int do_length(stateT&, const externT* from, const externT* end, size_t max) const;
> };
But some standard libraries (notably older Dinkumware libraries, and Visual C++ before Visual Studio11) say:
> virtual int do_length(const stateT&, const externT* from, const externT* end, size_t max) const;
(the first parameter is a const reference)
There's some preprocessor stuff to deal with this in boost/detail/utf8_codecvt_facet.hpp, but it's wrong:
> #if !defined(__MSL_CPP__) && !defined(__LIBCOMO__) \
> && !defined(_LIBCPP_VERSION)
> #define BOOST_CODECVT_DO_LENGTH_CONST const
> #else
> #define BOOST_CODECVT_DO_LENGTH_CONST
> #endif
>
> virtual int do_length(
> BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
> const char * from,
> const char * from_end,
> std::size_t max_limit
> #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
> ) const throw();
> #else
> ) const;
> #endif
I'm happy to fix this, but I'd like to be sure which systems actually have const parameters.
I've checked gcc and libc++, and they match the standard.
STL assures me that all versions of Visual Studio before VS11 do not match, but VS11 does.
The #defines above suggest to me that LibCOMO has this problem as well.
Does anyone have access to such an install?
And if anyone's standard library (that I haven't listed) does define the first parameter to std::codecvt<>::do_length as a const reference, please let me know.
Thanks!
-- Marshall
Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk