C++14 フリー関数版のcbegin()/cend()

LWG#2128. Absence of global functions cbegin/cend


C++11では範囲for文のために、std::begin()/std::end()という関数が入りました。
cbegin()/cend()もあっていいだろう、とのことで、C++14にこれらの関数が追加されることになりました。
ついでに逆順用のrbegin()/rend()/crbegin()/crend()も追加されることになったようなので、以下の関数がヘッダに追加されます。

namespace std {

template <class C> auto cbegin(const C& c) -> decltype(std::begin(c));
template <class C> auto cend(const C& c) -> decltype(std::end(c));
template <class C> auto rbegin(C& c) -> decltype(c.rbegin());
template <class C> auto rbegin(const C& c) -> decltype(c.rbegin());
template <class C> auto rend(C& c) -> decltype(c.rend());
template <class C> auto rend(const C& c) -> decltype(c.rend());
template <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]);
template <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]);
template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il);
template <class E> reverse_iterator<const E*> rend(initializer_list<E> il);
template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c));
template <class C> auto crend(const C& c) -> decltype(std::rend(c));

}