constexpr applied to <string>.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160563 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2012-07-20 19:09:12 +00:00
parent e41f475a44
commit 03d7181b0e

View File

@ -51,8 +51,8 @@ struct char_traits
typedef mbstate_t state_type;
static void assign(char_type& c1, const char_type& c2) noexcept;
static bool eq(char_type c1, char_type c2) noexcept;
static bool lt(char_type c1, char_type c2) noexcept;
static constexpr bool eq(char_type c1, char_type c2) noexcept;
static constexpr bool lt(char_type c1, char_type c2) noexcept;
static int compare(const char_type* s1, const char_type* s2, size_t n);
static size_t length(const char_type* s);
@ -61,11 +61,11 @@ struct char_traits
static char_type* copy(char_type* s1, const char_type* s2, size_t n);
static char_type* assign(char_type* s, size_t n, char_type a);
static int_type not_eof(int_type c) noexcept;
static char_type to_char_type(int_type c) noexcept;
static int_type to_int_type(char_type c) noexcept;
static bool eq_int_type(int_type c1, int_type c2) noexcept;
static int_type eof() noexcept;
static constexpr int_type not_eof(int_type c) noexcept;
static constexpr char_type to_char_type(int_type c) noexcept;
static constexpr int_type to_int_type(char_type c) noexcept;
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
static constexpr int_type eof() noexcept;
};
template <> struct char_traits<char>;
@ -506,10 +506,10 @@ struct _LIBCPP_VISIBLE char_traits
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@ -519,19 +519,20 @@ struct _LIBCPP_VISIBLE char_traits
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
static char_type to_char_type(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static int_type to_int_type(char_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static int_type eof() _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(EOF);}
};
@ -631,10 +632,10 @@ struct _LIBCPP_VISIBLE char_traits<char>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return (unsigned char)__c1 < (unsigned char)__c2;}
_LIBCPP_INLINE_VISIBILITY
@ -655,19 +656,20 @@ struct _LIBCPP_VISIBLE char_traits<char>
static char_type* assign(char_type* __s, size_t __n, char_type __a)
{return (char_type*)memset(__s, to_int_type(__a), __n);}
_LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
static char_type to_char_type(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static int_type to_int_type(char_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type((unsigned char)__c);}
_LIBCPP_INLINE_VISIBILITY
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static int_type eof() _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(EOF);}
};
@ -686,10 +688,10 @@ struct _LIBCPP_VISIBLE char_traits<wchar_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
_LIBCPP_INLINE_VISIBILITY
@ -712,19 +714,19 @@ struct _LIBCPP_VISIBLE char_traits<wchar_t>
{return (char_type*)wmemset(__s, __a, __n);}
_LIBCPP_INLINE_VISIBILITY
static int_type not_eof(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
static char_type to_char_type(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static int_type to_int_type(char_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static int_type eof() _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(WEOF);}
};
@ -743,10 +745,10 @@ struct _LIBCPP_VISIBLE char_traits<char16_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@ -757,19 +759,19 @@ struct _LIBCPP_VISIBLE char_traits<char16_t>
static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY
static int_type not_eof(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
static char_type to_char_type(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static int_type to_int_type(char_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static int_type eof() _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(0xDFFF);}
};
@ -863,10 +865,10 @@ struct _LIBCPP_VISIBLE char_traits<char32_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@ -877,19 +879,19 @@ struct _LIBCPP_VISIBLE char_traits<char32_t>
static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY
static int_type not_eof(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
static char_type to_char_type(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static int_type to_int_type(char_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
static int_type eof() _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(0xFFFFFFFF);}
};