Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions include/proxy/v4/proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -1753,8 +1753,9 @@ struct explicit_conversion_adapter {
T&& value_;
};

constexpr std::size_t invalid_size = std::numeric_limits<std::size_t>::max();
constexpr constraint_level invalid_cl = static_cast<constraint_level>(
inline constexpr std::size_t invalid_size =
std::numeric_limits<std::size_t>::max();
inline constexpr constraint_level invalid_cl = static_cast<constraint_level>(
std::numeric_limits<std::underlying_type_t<constraint_level>>::min());
consteval std::size_t merge_size(std::size_t a, std::size_t b) {
return a < b ? a : b;
Expand Down
17 changes: 9 additions & 8 deletions tests/proxy_dispatch_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ struct PtrToMemTester {
int value_;
};

struct TestFacadeBase : pro::facade_builder //
::add_convention<pro::operator_dispatch<"<<", true>,
std::ostream&(std::ostream& out)> //
::build {};

PRO_DEF_FREE_AS_MEM_DISPATCH(FreeMemToString, std::to_string, ToString);

} // namespace proxy_dispatch_tests_details
Expand Down Expand Up @@ -784,21 +789,17 @@ TEST(ProxyDispatchTests, TestIndirectConversion) {
}

TEST(ProxyDispatchTests, TestDirectConversion) {
struct TestFacadeBase : pro::facade_builder //
::add_convention<pro::operator_dispatch<"<<", true>,
std::ostream&(std::ostream & out)> //
::build {};
struct TestFacade
: pro::facade_builder //
::add_facade<TestFacadeBase> //
::add_facade<details::TestFacadeBase> //
::add_convention<pro::operator_dispatch<"+=">, void(int val)> //
::add_direct_convention<pro::conversion_dispatch,
pro::proxy<TestFacadeBase>() &&> //
pro::proxy<details::TestFacadeBase>() &&> //
::build {};
pro::proxy<TestFacade> p1 = std::make_unique<int>(123);
*p1 += 3;
pro::proxy<TestFacadeBase> p2 =
static_cast<pro::proxy<TestFacadeBase>>(std::move(p1));
pro::proxy<details::TestFacadeBase> p2 =
static_cast<pro::proxy<details::TestFacadeBase>>(std::move(p1));
ASSERT_FALSE(p1.has_value());
std::ostringstream stream;
stream << *p2;
Expand Down