diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-03-29 07:39:03 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-03-29 07:42:20 +0200 |
commit | dbf238ba0a76c64643a28fc3fd9d0d3ede848dd7 (patch) | |
tree | 8dd9720bc5d4c3406008d84c12231c77bf238819 /sal/inc/rtl | |
parent | 175dc9fcc6252177e03486952e867c7bd1f8e9de (diff) |
(const) char[] is a plain C string type too
and it's size is not known, so it cannot be taken as a string literal
Diffstat (limited to 'sal/inc/rtl')
-rw-r--r-- | sal/inc/rtl/stringutils.hxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sal/inc/rtl/stringutils.hxx b/sal/inc/rtl/stringutils.hxx index 3bf72c54064e..19c1bf460fb4 100644 --- a/sal/inc/rtl/stringutils.hxx +++ b/sal/inc/rtl/stringutils.hxx @@ -50,7 +50,8 @@ namespace internal { /* These templates use SFINAE (Substitution failure is not an error) to help distinguish the various -plain C string types: char*, const char*, char[N] and const char[N]. There are 2 cases: +plain C string types: char*, const char*, char[N], const char[N], char[] and const char[]. +There are 2 cases: 1) Only string literal (i.e. const char[N]) is wanted, not any of the others. In this case it is necessary to distinguish between const char[N] and char[N], as the latter would be automatically converted to the const variant, which is not wanted (not a string literal @@ -90,6 +91,16 @@ struct NonConstCharArrayDetector< char[ N ], T > { typedef T Type; }; +template< typename T > +struct NonConstCharArrayDetector< char[], T > +{ + typedef T Type; +}; +template< typename T > +struct NonConstCharArrayDetector< const char[], T > +{ + typedef T Type; +}; template< typename T1, typename T2 > struct ConstCharArrayDetector |