summaryrefslogtreecommitdiffstats
path: root/libcxx/include/initializer_list
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-08-26 20:11:32 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-08-26 20:11:32 +0000
commit93288117a546ee31a4a9ff91ce48b1038cc21075 (patch)
treea041f2aea93b6af073ab9ca0bf267d4682983adf /libcxx/include/initializer_list
parent5f71aab12eaa0b245ab5274df66f183e9c7dd774 (diff)
downloadbcm5719-llvm-93288117a546ee31a4a9ff91ce48b1038cc21075.tar.gz
bcm5719-llvm-93288117a546ee31a4a9ff91ce48b1038cc21075.zip
Apply constexpr to initializer_list for c++1y.
llvm-svn: 189271
Diffstat (limited to 'libcxx/include/initializer_list')
-rw-r--r--libcxx/include/initializer_list33
1 files changed, 23 insertions, 10 deletions
diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list
index cdcd6881679..663e49b6ee4 100644
--- a/libcxx/include/initializer_list
+++ b/libcxx/include/initializer_list
@@ -29,15 +29,15 @@ public:
typedef const E* iterator;
typedef const E* const_iterator;
- initializer_list() noexcept;
+ initializer_list() noexcept; // constexpr in C++14
- size_t size() const noexcept;
- const E* begin() const noexcept;
- const E* end() const noexcept;
+ size_t size() const noexcept; // constexpr in C++14
+ const E* begin() const noexcept; // constexpr in C++14
+ const E* end() const noexcept; // constexpr in C++14
};
-template<class E> const E* begin(initializer_list<E> il) noexcept;
-template<class E> const E* end(initializer_list<E> il) noexcept;
+template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
+template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
} // std
@@ -62,6 +62,7 @@ class _LIBCPP_TYPE_VIS_ONLY initializer_list
size_t __size_;
_LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
: __begin_(__b),
__size_(__s)
@@ -75,15 +76,26 @@ public:
typedef const _Ep* iterator;
typedef const _Ep* const_iterator;
- _LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
+ initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
- _LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
- _LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;}
- _LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
+ size_t size() const _NOEXCEPT {return __size_;}
+
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
+ const _Ep* begin() const _NOEXCEPT {return __begin_;}
+
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR_AFTER_CXX11
+ const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
};
template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR_AFTER_CXX11
const _Ep*
begin(initializer_list<_Ep> __il) _NOEXCEPT
{
@@ -92,6 +104,7 @@ begin(initializer_list<_Ep> __il) _NOEXCEPT
template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR_AFTER_CXX11
const _Ep*
end(initializer_list<_Ep> __il) _NOEXCEPT
{
OpenPOWER on IntegriCloud