(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
This commit is contained in:
@@ -50,7 +50,8 @@ namespace internal
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
These templates use SFINAE (Substitution failure is not an error) to help distinguish the various
|
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.
|
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
|
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
|
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;
|
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 >
|
template< typename T1, typename T2 >
|
||||||
struct ConstCharArrayDetector
|
struct ConstCharArrayDetector
|
||||||
|
Reference in New Issue
Block a user