[cfe-commits] [libcxx] r160563 - /libcxx/trunk/include/string
Howard Hinnant
hhinnant at apple.com
Fri Jul 20 12:09:12 PDT 2012
Author: hhinnant
Date: Fri Jul 20 14:09:12 2012
New Revision: 160563
URL: http://llvm.org/viewvc/llvm-project?rev=160563&view=rev
Log:
constexpr applied to <string>.
Modified:
libcxx/trunk/include/string
Modified: libcxx/trunk/include/string
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=160563&r1=160562&r2=160563&view=diff
==============================================================================
--- libcxx/trunk/include/string (original)
+++ libcxx/trunk/include/string Fri Jul 20 14:09:12 2012
@@ -51,8 +51,8 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
{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 @@
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 @@
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 @@
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 @@
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);}
};
More information about the cfe-commits
mailing list