-
Notifications
You must be signed in to change notification settings - Fork 760
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #325 from gummif/gfa/msg-range-ctor
Problem: message_t ctor for ranges too greedy
- Loading branch information
Showing
5 changed files
with
162 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#include <catch.hpp> | ||
#include <zmq.hpp> | ||
|
||
#ifdef ZMQ_CPP11 | ||
|
||
namespace test_ns | ||
{ | ||
struct T_nr | ||
{ | ||
}; | ||
struct T_mr | ||
{ | ||
void *begin() const noexcept { return nullptr; } | ||
void *end() const noexcept { return nullptr; } | ||
}; | ||
struct T_fr | ||
{ | ||
}; | ||
void *begin(const T_fr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
void *end(const T_fr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
struct T_mfr | ||
{ | ||
void *begin() const noexcept { return nullptr; } | ||
void *end() const noexcept { return nullptr; } | ||
}; | ||
void *begin(const T_mfr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
void *end(const T_mfr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
|
||
// types with associated namespace std | ||
struct T_assoc_ns_nr : std::exception | ||
{ | ||
}; | ||
struct T_assoc_ns_mr : std::exception | ||
{ | ||
void *begin() const noexcept { return nullptr; } | ||
void *end() const noexcept { return nullptr; } | ||
}; | ||
struct T_assoc_ns_fr : std::exception | ||
{ | ||
}; | ||
void *begin(const T_assoc_ns_fr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
void *end(const T_assoc_ns_fr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
struct T_assoc_ns_mfr : std::exception | ||
{ | ||
void *begin() const noexcept { return nullptr; } | ||
void *end() const noexcept { return nullptr; } | ||
}; | ||
void *begin(const T_assoc_ns_mfr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
void *end(const T_assoc_ns_mfr &) noexcept | ||
{ | ||
return nullptr; | ||
} | ||
} // namespace test_ns | ||
|
||
TEST_CASE("range SFINAE", "[utilities]") | ||
{ | ||
CHECK(!zmq::detail::is_range<int>::value); | ||
CHECK(zmq::detail::is_range<std::string>::value); | ||
CHECK(zmq::detail::is_range<std::string &>::value); | ||
CHECK(zmq::detail::is_range<const std::string &>::value); | ||
CHECK(zmq::detail::is_range<decltype("hello")>::value); | ||
CHECK(zmq::detail::is_range<std::initializer_list<int>>::value); | ||
|
||
CHECK(!zmq::detail::is_range<test_ns::T_nr>::value); | ||
CHECK(zmq::detail::is_range<test_ns::T_mr>::value); | ||
CHECK(zmq::detail::is_range<test_ns::T_fr>::value); | ||
CHECK(zmq::detail::is_range<test_ns::T_mfr>::value); | ||
|
||
CHECK(!zmq::detail::is_range<test_ns::T_assoc_ns_nr>::value); | ||
CHECK(zmq::detail::is_range<test_ns::T_assoc_ns_mr>::value); | ||
CHECK(zmq::detail::is_range<test_ns::T_assoc_ns_fr>::value); | ||
CHECK(zmq::detail::is_range<test_ns::T_assoc_ns_mfr>::value); | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters