Skip to content

Commit

Permalink
Enable IsNull() for older versions of MSVC
Browse files Browse the repository at this point in the history
IsNull() is only available for C++11. However, older versions of
MSVC know nullptr and std::nullptr_r and can also handle IsNull().
This commit uses the workaround proposed by @wisk in issue #17 to
enable IsNull() for MSVC version identifiers >= 1600.
  • Loading branch information
sbeyer committed Nov 25, 2016
1 parent 15b6c43 commit 33a21aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/basic_assertions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void BasicAssertions()
"Expected: less than or equal to 5\nActual: 6\n");
}

#if __cplusplus > 199711L
#if __cplusplus > 199711L || (defined(_MSC_VER) && _MSC_VER >= 1600)
std::cout << "ShouldHandleNull" << std::endl;
{
Assert::That(nullptr, IsNull());
Expand Down
2 changes: 1 addition & 1 deletion snowhouse/constraints/equalsconstraint.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace snowhouse {
return EqualsConstraint<bool>(true);
}

#if __cplusplus > 199711L
#if __cplusplus > 199711L || (defined(_MSC_VER) && _MSC_VER >= 1600)
inline EqualsConstraint<std::nullptr_t> IsNull()
{
return EqualsConstraint<std::nullptr_t>(nullptr);
Expand Down

0 comments on commit 33a21aa

Please sign in to comment.