From 15f02da7bd96175523810b3e44e8502f730cb4f7 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Fri, 24 Jun 2016 19:56:50 +1000 Subject: [PATCH] Improved workaround for missing cbegin/cend in glibstdc++ [Alex Miller] --- src/lib/util/strformat.h | 28 ++++++++++++++-------------- src/lib/util/vecstream.h | 6 +++--- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/lib/util/strformat.h b/src/lib/util/strformat.h index 975f3f39de5..7fb41c1d52b 100644 --- a/src/lib/util/strformat.h +++ b/src/lib/util/strformat.h @@ -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 #include @@ -185,18 +185,18 @@ #include #include -#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20150413) -namespace std -{ -template - 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 +inline constexpr auto cbegin(const T& cont) noexcept(noexcept(std::begin(cont))) -> decltype(std::begin(cont)) +{ return std::begin(cont); } -template - inline constexpr auto - cend(const _Container& __cont) noexcept(noexcept(std::end(__cont)))-> decltype(std::end(__cont)) - { return std::end(__cont); } +template +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 diff --git a/src/lib/util/vecstream.h b/src/lib/util/vecstream.h index 4491c1d61b7..aaf0e84e61b 100644 --- a/src/lib/util/vecstream.h +++ b/src/lib/util/vecstream.h @@ -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 #include @@ -395,4 +395,4 @@ void swap(basic_vectorstream &a, basic_vectorstream