From 073edee87bd926e0002f42b04b25cf872ffd6426 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 7 Nov 2019 13:16:14 -0800 Subject: [PATCH] minor --- src/utilpvt.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/utilpvt.h b/src/utilpvt.h index 9bb8630..bf9ca75 100644 --- a/src/utilpvt.h +++ b/src/utilpvt.h @@ -16,6 +16,8 @@ #include #include +#include + #include #include @@ -58,26 +60,26 @@ struct Range { struct iterator : std::iterator_traits { I val; - explicit iterator(I val) :val(val) {} - inline I operator*() const { return val; } - inline iterator& operator++() { val++; return *this; } - inline iterator operator++(int) { return iterator{val++}; } - inline bool operator==(const iterator& o) const { return val==o.val; } - inline bool operator!=(const iterator& o) const { return val!=o.val; } + explicit constexpr iterator(I val) :val(val) {} + EPICS_ALWAYS_INLINE I operator*() const { return val; } + EPICS_ALWAYS_INLINE iterator& operator++() { val++; return *this; } + EPICS_ALWAYS_INLINE iterator operator++(int) { return iterator{val++}; } + EPICS_ALWAYS_INLINE bool operator==(const iterator& o) const { return val==o.val; } + EPICS_ALWAYS_INLINE bool operator!=(const iterator& o) const { return val!=o.val; } }; - inline iterator begin() const { return iterator{a}; } - inline iterator cbegin() const { return begin(); } - inline iterator end() const { return iterator{b}; } - inline iterator cend() const { return end(); } + EPICS_ALWAYS_INLINE iterator begin() const { return iterator{a}; } + EPICS_ALWAYS_INLINE iterator cbegin() const { return begin(); } + EPICS_ALWAYS_INLINE iterator end() const { return iterator{b}; } + EPICS_ALWAYS_INLINE iterator cend() const { return end(); } }; } // namespace detail template -detail::Range range(I end) { return detail::Range{I(0), end}; } +constexpr detail::Range range(I end) { return detail::Range{I(0), end}; } template -detail::Range range(I begin, I end) { return detail::Range{begin, end}; } +constexpr detail::Range range(I begin, I end) { return detail::Range{begin, end}; } class RWLock {