|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r76471 - in trunk: boost/locale/boundary libs/locale/src/posix libs/locale/test
From: artyomtnk_at_[hidden]
Date: 2012-01-13 16:24:36
Author: artyom
Date: 2012-01-13 16:24:35 EST (Fri, 13 Jan 2012)
New Revision: 76471
URL: http://svn.boost.org/trac/boost/changeset/76471
Log:
STLPort support fixes:
- Fixed linear_iterator_traits to work when std::string::iterator == "char*"
- Workaround of missing operator '|' fork mask
Text files modified:
trunk/boost/locale/boundary/index.hpp | 38 ++++++++------------------------------
trunk/libs/locale/src/posix/numeric.cpp | 14 ++++++++++----
trunk/libs/locale/test/test_locale.hpp | 2 +-
3 files changed, 19 insertions(+), 35 deletions(-)
Modified: trunk/boost/locale/boundary/index.hpp
==============================================================================
--- trunk/boost/locale/boundary/index.hpp (original)
+++ trunk/boost/locale/boundary/index.hpp 2012-01-13 16:24:35 EST (Fri, 13 Jan 2012)
@@ -59,38 +59,16 @@
template<typename CharType,typename SomeIteratorType>
struct linear_iterator_traits {
- static const bool is_linear = false;
+ static const bool is_linear =
+ is_same<SomeIteratorType,CharType*>::value
+ || is_same<SomeIteratorType,CharType const*>::value
+ || is_same<SomeIteratorType,typename std::basic_string<CharType>::iterator>::value
+ || is_same<SomeIteratorType,typename std::basic_string<CharType>::const_iterator>::value
+ || is_same<SomeIteratorType,typename std::vector<CharType>::iterator>::value
+ || is_same<SomeIteratorType,typename std::vector<CharType>::const_iterator>::value
+ ;
};
- template<typename CharType>
- struct linear_iterator_traits<CharType,typename std::basic_string<CharType>::iterator> {
- static const bool is_linear = true;
- };
-
- template<typename CharType>
- struct linear_iterator_traits<CharType,typename std::basic_string<CharType>::const_iterator> {
- static const bool is_linear = true;
- };
-
- template<typename CharType>
- struct linear_iterator_traits<CharType,typename std::vector<CharType>::iterator> {
- static const bool is_linear = true;
- };
-
- template<typename CharType>
- struct linear_iterator_traits<CharType,typename std::vector<CharType>::const_iterator> {
- static const bool is_linear = true;
- };
-
- template<typename CharType>
- struct linear_iterator_traits<CharType,CharType *> {
- static const bool is_linear = true;
- };
-
- template<typename CharType>
- struct linear_iterator_traits<CharType,CharType const *> {
- static const bool is_linear = true;
- };
template<typename IteratorType>
Modified: trunk/libs/locale/src/posix/numeric.cpp
==============================================================================
--- trunk/libs/locale/src/posix/numeric.cpp (original)
+++ trunk/libs/locale/src/posix/numeric.cpp 2012-01-13 16:24:35 EST (Fri, 13 Jan 2012)
@@ -210,7 +210,7 @@
{
while(begin!=end) {
char c= *begin++;
- mask r=mask();
+ int r=0;
if(isspace_l(c,*lc_))
r|=space;
if(isprint_l(c,*lc_))
@@ -229,7 +229,10 @@
r|=xdigit;
if(ispunct_l(c,*lc_))
r|=punct;
- *m++ = r;
+ // r actually should be mask, but some standard
+ // libraries (like STLPort)
+ // do not define operator | properly so using int+cast
+ *m++ = static_cast<mask>(r);
}
return begin;
}
@@ -305,7 +308,7 @@
{
while(begin!=end) {
wchar_t c= *begin++;
- mask r=mask();
+ int r=0;
if(iswspace_l(c,*lc_))
r|=space;
if(iswprint_l(c,*lc_))
@@ -324,7 +327,10 @@
r|=xdigit;
if(iswpunct_l(c,*lc_))
r|=punct;
- *m++ = r;
+ // r actually should be mask, but some standard
+ // libraries (like STLPort)
+ // do not define operator | properly so using int+cast
+ *m++ = static_cast<mask>(r);
}
return begin;
}
Modified: trunk/libs/locale/test/test_locale.hpp
==============================================================================
--- trunk/libs/locale/test/test_locale.hpp (original)
+++ trunk/libs/locale/test/test_locale.hpp 2012-01-13 16:24:35 EST (Fri, 13 Jan 2012)
@@ -13,7 +13,7 @@
#include <iostream>
#include <iomanip>
#include <cstdlib>
-
+#include <string>
int error_counter=0;
int test_counter=0;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk