mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Fix Visual Studio 2013 build
This commit is contained in:
@@ -253,6 +253,7 @@
|
|||||||
<ClInclude Include="..\..\beast\utility\PropertyStream.h" />
|
<ClInclude Include="..\..\beast\utility\PropertyStream.h" />
|
||||||
<ClInclude Include="..\..\beast\utility\StaticObject.h" />
|
<ClInclude Include="..\..\beast\utility\StaticObject.h" />
|
||||||
<ClInclude Include="..\..\beast\utility\type_name.h" />
|
<ClInclude Include="..\..\beast\utility\type_name.h" />
|
||||||
|
<ClInclude Include="..\..\beast\utility\zero.h" />
|
||||||
<ClInclude Include="..\..\beast\Version.h" />
|
<ClInclude Include="..\..\beast\Version.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\async\AsyncObject.h" />
|
<ClInclude Include="..\..\modules\beast_asio\async\AsyncObject.h" />
|
||||||
<ClInclude Include="..\..\modules\beast_asio\basics\FixedInputBuffer.h" />
|
<ClInclude Include="..\..\modules\beast_asio\basics\FixedInputBuffer.h" />
|
||||||
@@ -767,7 +768,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\beast\utility\tests\hardened_hash.test.cpp">
|
<ClCompile Include="..\..\beast\utility\tests\Zero.test.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@@ -1201,6 +1201,9 @@
|
|||||||
<ClInclude Include="..\..\beast\utility\type_name.h">
|
<ClInclude Include="..\..\beast\utility\type_name.h">
|
||||||
<Filter>beast\utility</Filter>
|
<Filter>beast\utility</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\beast\utility\zero.h">
|
||||||
|
<Filter>beast\utility</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\modules\beast_core\files\DirectoryIterator.cpp">
|
<ClCompile Include="..\..\modules\beast_core\files\DirectoryIterator.cpp">
|
||||||
@@ -1647,9 +1650,6 @@
|
|||||||
<ClCompile Include="..\..\beast\threads\tests\Atomic.test.cpp">
|
<ClCompile Include="..\..\beast\threads\tests\Atomic.test.cpp">
|
||||||
<Filter>beast\threads\tests</Filter>
|
<Filter>beast\threads\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\beast\utility\tests\hardened_hash.test.cpp">
|
|
||||||
<Filter>beast\utility\tests</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\beast\crypto\tests\BinaryEncoding.cpp">
|
<ClCompile Include="..\..\beast\crypto\tests\BinaryEncoding.cpp">
|
||||||
<Filter>beast\crypto\tests</Filter>
|
<Filter>beast\crypto\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -1665,6 +1665,9 @@
|
|||||||
<ClCompile Include="..\..\beast\container\impl\spookyv2.cpp">
|
<ClCompile Include="..\..\beast\container\impl\spookyv2.cpp">
|
||||||
<Filter>beast\container\impl</Filter>
|
<Filter>beast\container\impl</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\beast\utility\tests\Zero.test.cpp">
|
||||||
|
<Filter>beast\utility\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="..\..\TODO.txt">
|
<Text Include="..\..\TODO.txt">
|
||||||
|
|||||||
@@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#include "../config/CompilerConfig.h"
|
#include "../config/CompilerConfig.h"
|
||||||
|
|
||||||
|
// VS2013 SP1 fails with decltype return
|
||||||
|
#define BEAST_NO_ZERO_AUTO_RETURN 1
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
/** Zero allows classes to offer efficient comparisons to zero.
|
/** Zero allows classes to offer efficient comparisons to zero.
|
||||||
@@ -41,97 +44,117 @@ namespace beast {
|
|||||||
returns a positive, zero or negative number.
|
returns a positive, zero or negative number.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct Zero {};
|
struct Zero
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static BEAST_CONSTEXPR Zero zero{};
|
static BEAST_CONSTEXPR Zero zero{};
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
/** Default implementation of signum calls the method on the class. */
|
||||||
|
|
||||||
/** The default implementation of signum calls the method on the class.
|
|
||||||
|
|
||||||
Calls to signum must be made from a namespace that does not include
|
|
||||||
overloads of the function.
|
|
||||||
*/
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
auto signum(T const& t) -> decltype(t.signum()) {
|
#if BEAST_NO_ZERO_AUTO_RETURN
|
||||||
|
int signum(T const& t)
|
||||||
|
#else
|
||||||
|
auto signum(T const& t) -> decltype(t.signum())
|
||||||
|
#endif
|
||||||
|
{
|
||||||
return t.signum();
|
return t.signum();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
namespace zero_helper {
|
namespace zero_helper {
|
||||||
|
|
||||||
|
// For argument dependent lookup to function properly, calls to signum must
|
||||||
|
// be made from a namespace that does not include overloads of the function..
|
||||||
template <class T>
|
template <class T>
|
||||||
auto call_signum (T const& t) -> decltype(signum(t)) {
|
#if BEAST_NO_ZERO_AUTO_RETURN
|
||||||
|
int call_signum (T const& t)
|
||||||
|
#else
|
||||||
|
auto call_signum(T const& t) -> decltype(t.signum())
|
||||||
|
#endif
|
||||||
|
{
|
||||||
return signum(t);
|
return signum(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // zero_helper
|
} // zero_helper
|
||||||
} // detail
|
} // detail
|
||||||
|
|
||||||
/** Handle operators where T is on the left side using signum. */
|
// Handle operators where T is on the left side using signum.
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator==(T const& t, Zero) {
|
bool operator==(T const& t, Zero)
|
||||||
|
{
|
||||||
return detail::zero_helper::call_signum(t) == 0;
|
return detail::zero_helper::call_signum(t) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator!=(T const& t, Zero) {
|
bool operator!=(T const& t, Zero)
|
||||||
|
{
|
||||||
return detail::zero_helper::call_signum(t) != 0;
|
return detail::zero_helper::call_signum(t) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator>(T const& t, Zero) {
|
bool operator<(T const& t, Zero)
|
||||||
return detail::zero_helper::call_signum(t) > 0;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool operator>=(T const& t, Zero) {
|
|
||||||
return detail::zero_helper::call_signum(t) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool operator<(T const& t, Zero) {
|
|
||||||
return detail::zero_helper::call_signum(t) < 0;
|
return detail::zero_helper::call_signum(t) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator<=(T const& t, Zero) {
|
bool operator>(T const& t, Zero)
|
||||||
|
{
|
||||||
|
return detail::zero_helper::call_signum(t) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool operator>=(T const& t, Zero)
|
||||||
|
{
|
||||||
|
return detail::zero_helper::call_signum(t) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool operator<=(T const& t, Zero)
|
||||||
|
{
|
||||||
return detail::zero_helper::call_signum(t) <= 0;
|
return detail::zero_helper::call_signum(t) <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle operators where T is on the right side by
|
||||||
|
// reversing the operation, so that T is on the left side.
|
||||||
|
|
||||||
/** Handle operators where T is on the right side by reversing the operation,
|
|
||||||
so that T is on the left side.
|
|
||||||
*/
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator==(Zero, T const& t) {
|
bool operator==(Zero, T const& t)
|
||||||
|
{
|
||||||
return t == zero;
|
return t == zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator!=(Zero, T const& t) {
|
bool operator!=(Zero, T const& t)
|
||||||
|
{
|
||||||
return t != zero;
|
return t != zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator>(Zero, T const& t) {
|
bool operator<(Zero, T const& t)
|
||||||
return t < zero;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool operator>=(Zero, T const& t) {
|
|
||||||
return t <= zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
bool operator<(Zero, T const& t) {
|
|
||||||
return t > zero;
|
return t > zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool operator<=(Zero, T const& t) {
|
bool operator>(Zero, T const& t)
|
||||||
|
{
|
||||||
|
return t < zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool operator>=(Zero, T const& t)
|
||||||
|
{
|
||||||
|
return t <= zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool operator<=(Zero, T const& t)
|
||||||
|
{
|
||||||
return t >= zero;
|
return t >= zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,20 @@ namespace beast {
|
|||||||
|
|
||||||
struct adl_tester {};
|
struct adl_tester {};
|
||||||
|
|
||||||
int signum (adl_tester) { return 0; }
|
int signum (adl_tester)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
struct adl_tester2 {};
|
struct adl_tester2 {};
|
||||||
|
|
||||||
int signum (adl_tester2) { return 0; }
|
int signum (adl_tester2)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // detail
|
} // detail
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user