From edceed8075e14c86aac7f86347331aafac122c30 Mon Sep 17 00:00:00 2001 From: Neil MacIntosh Date: Tue, 13 Sep 2016 14:30:02 -0700 Subject: [PATCH] Adding inline to all byte-related functions for MSVC 2013. --- gsl/gsl_byte | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gsl/gsl_byte b/gsl/gsl_byte index bee1092..ab5e4e3 100644 --- a/gsl/gsl_byte +++ b/gsl/gsl_byte @@ -26,7 +26,7 @@ // constexpr is not understood #pragma push_macro("constexpr") -#define constexpr /*constexpr*/ +#define constexpr /*constexpr*/ // noexcept is not understood #pragma push_macro("noexcept") @@ -45,25 +45,25 @@ enum class byte : unsigned char }; template ::value>> -constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept +inline constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept { return b = byte(static_cast(b) << shift); } template ::value>> -constexpr byte operator<<(byte b, IntegerType shift) noexcept +inline constexpr byte operator<<(byte b, IntegerType shift) noexcept { return byte(static_cast(b) << shift); } template ::value>> -constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept +inline constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept { return b = byte(static_cast(b) >> shift); } template ::value>> -constexpr byte operator>>(byte b, IntegerType shift) noexcept +inline constexpr byte operator>>(byte b, IntegerType shift) noexcept { return byte(static_cast(b) >> shift); } @@ -101,13 +101,13 @@ inline constexpr byte operator^(byte l, byte r) noexcept inline constexpr byte operator~(byte b) noexcept { return byte(~static_cast(b)); } template ::value>> -constexpr IntegerType to_integer(byte b) noexcept +inline constexpr IntegerType to_integer(byte b) noexcept { return {b}; } template -constexpr byte to_byte_impl(T t) noexcept +inline constexpr byte to_byte_impl(T t) noexcept { static_assert( E, @@ -117,19 +117,19 @@ constexpr byte to_byte_impl(T t) noexcept return static_cast(t); } template<> -constexpr byte to_byte_impl(unsigned char t) noexcept +inline constexpr byte to_byte_impl(unsigned char t) noexcept { return byte(t); } template -constexpr byte to_byte(T t) noexcept +inline constexpr byte to_byte(T t) noexcept { return to_byte_impl::value, T>(t); } template -constexpr byte to_byte() noexcept +inline constexpr byte to_byte() noexcept { static_assert(I >= 0 && I <= 255, "gsl::byte only has 8 bits of storage, values must be in range 0-255"); return static_cast(I);