diff options
author | 2016-06-24 19:56:50 +1000 | |
---|---|---|
committer | 2016-06-24 19:56:50 +1000 | |
commit | 15f02da7bd96175523810b3e44e8502f730cb4f7 (patch) | |
tree | 928afd55818811ac0744c10cfba7347c3d2a7d1f /src/lib/util/strformat.h | |
parent | 5ece80fe5d693a022e4584f5f9c6dd57d3802a24 (diff) |
Improved workaround for missing cbegin/cend in glibstdc++ [Alex Miller]
Diffstat (limited to 'src/lib/util/strformat.h')
-rw-r--r-- | src/lib/util/strformat.h | 30 |
1 files changed, 15 insertions, 15 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 <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); } - -template<class _Container> - inline constexpr auto - cend(const _Container& __cont) noexcept(noexcept(std::end(__cont)))-> decltype(std::end(__cont)) - { return std::end(__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 <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 |