From b52127bcbf817ff8285b36d22198b275327e16bb Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 16 Dec 2012 17:47:51 -0800 Subject: Cleanup headers and remove all uses of va_list except logging --- src/common/utils2.hpp | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'src/common/utils2.hpp') diff --git a/src/common/utils2.hpp b/src/common/utils2.hpp index aef6f73..c92fdae 100644 --- a/src/common/utils2.hpp +++ b/src/common/utils2.hpp @@ -1,8 +1,8 @@ // included by utils.hpp as a porting aid. // Eventually it will be promoted to one or more normal headers. -#include #include +#include template struct earray @@ -64,14 +64,14 @@ public: template class IteratorPair { - It b, e; + It _b, _e; public: IteratorPair(It b, It e) - : b(b), e(e) + : _b(b), _e(e) {} - It begin() { return b; } - It end() { return e; } + It begin() { return _b; } + It end() { return _e; } }; template @@ -80,27 +80,23 @@ IteratorPair iterator_pair(It b, It e) return {b, e}; } -#ifndef HAVE_STD_UNDERLYING_TYPE -// Note: you *must* correctly define/not define this - it conflicts! -namespace std +// std::underlying_type isn't supported until gcc 4.7 +// this is a poor man's emulation +template +struct underlying_type { - template - struct underlying_type - { - static_assert(std::is_enum::value, "Only enums have underlying type!"); - typedef typename std::conditional< - std::is_signed::value, - typename std::make_signed::type, - typename std::make_unsigned::type - >::type type; - }; -} -#endif // HAVE_STD_UNDERLYING_TYPE + static_assert(std::is_enum::value, "Only enums have underlying type!"); + typedef typename std::conditional< + std::is_signed::value, + typename std::make_signed::type, + typename std::make_unsigned::type + >::type type; +}; template class EnumValueIterator { - typedef typename std::underlying_type::type U; + typedef typename underlying_type::type U; E value; public: EnumValueIterator(E v) @@ -136,3 +132,6 @@ IteratorPair> erange(E b, E e) { return {b, e}; } + +namespace std { namespace placeholders {} } +namespace ph = std::placeholders; -- cgit v1.2.3-60-g2f50