Improved workaround for missing cbegin/cend in glibstdc++ [Alex Miller]

This commit is contained in:
Vas Crabb 2016-06-24 19:56:50 +10:00
parent 5ece80fe5d
commit 15f02da7bd
2 changed files with 17 additions and 17 deletions

View File

@ -168,8 +168,8 @@
#pragma once
#ifndef __MAME_UTIL_STRFORMAT_H__
#define __MAME_UTIL_STRFORMAT_H__
#ifndef MAME_UTIL_STRFORMAT_H
#define MAME_UTIL_STRFORMAT_H
#include <algorithm>
#include <array>
@ -185,18 +185,18 @@
#include <type_traits>
#include <utility>
#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20150413)
namespace std
{
template<class _Container>
inline constexpr auto
cbegin(const _Container& __cont) noexcept(noexcept(std::begin(__cont)))-> decltype(std::begin(__cont))
{ return std::begin(__cont); }
#if defined(__GLIBCXX__)
namespace std {
namespace mame_cxx14_compat {
template <typename T>
inline constexpr auto cbegin(const T& cont) noexcept(noexcept(std::begin(cont))) -> decltype(std::begin(cont))
{ return std::begin(cont); }
template<class _Container>
inline constexpr auto
cend(const _Container& __cont) noexcept(noexcept(std::end(__cont)))-> decltype(std::end(__cont))
{ return std::end(__cont); }
template <typename T>
inline constexpr auto cend(const T& cont) noexcept(noexcept(std::end(cont))) -> decltype(std::end(cont))
{ return std::end(cont); }
}
using namespace mame_cxx14_compat;
}
#endif
@ -1746,4 +1746,4 @@ using detail::make_format_argument_pack;
using util::string_format;
#endif // __MAME_UTIL_STRFORMAT_H__
#endif // MAME_UTIL_STRFORMAT_H

View File

@ -14,8 +14,8 @@
***************************************************************************/
#ifndef __MAME_UTIL_VECSTREAM_H__
#define __MAME_UTIL_VECSTREAM_H__
#ifndef MAME_UTIL_VECSTREAM_H
#define MAME_UTIL_VECSTREAM_H
#include <algorithm>
#include <cassert>
@ -395,4 +395,4 @@ void swap(basic_vectorstream<CharT, Traits, Allocator> &a, basic_vectorstream<Ch
} // namespace util
#endif // __MAME_UTIL_VECSTREAM_H__
#endif // MAME_UTIL_VECSTREAM_H