Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proxy: add version 3.0.0 #25350

Merged
merged 4 commits into from
Sep 23, 2024
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
3 changes: 3 additions & 0 deletions recipes/proxy/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"3.0.0":
url: "https://github.com/microsoft/proxy/archive/refs/tags/3.0.0.tar.gz"
sha256: "7e073e217e5572bc4c17ed5893273c80ea34c87e1406c853beeb9ca9bdda9733"
"2.4.0":
url: "https://github.com/microsoft/proxy/archive/refs/tags/2.4.0.tar.gz"
sha256: "7eed973655938d681a90dcc0c200e6cc1330ea8611a9c1a9e1b30439514443cb"
Expand Down
3 changes: 3 additions & 0 deletions recipes/proxy/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ find_package(proxy REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE msft_proxy)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
if(proxy_VERSION VERSION_GREATER_EQUAL "3.0.0")
target_compile_definitions(${PROJECT_NAME} PRIVATE PROXY_VERSION_3_LATER)
endif()
24 changes: 24 additions & 0 deletions recipes/proxy/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@
#include <string>
#include <vector>

#ifdef PROXY_VERSION_3_LATER

PRO_DEF_MEM_DISPATCH(MemAt, at);

struct Dictionary : pro::facade_builder
::add_convention<MemAt, std::string(int)>
::build {};

// This is a function, rather than a function template
void demo_print(pro::proxy<Dictionary> dictionary) {
std::cout << dictionary->at(1) << "\n";
}

int main() {
static std::map<int, std::string> container1{{1, "hello"}};
auto container2 = std::make_shared<std::vector<const char*>>();
container2->push_back("hello");
container2->push_back("world");
demo_print(&container1); // Prints: "hello"
demo_print(container2); // Prints: "world"
}

#else

namespace poly {

Expand All @@ -45,3 +68,4 @@ int main() {
demo_print(&container2); // print: world\n
return 0;
}
#endif
2 changes: 2 additions & 0 deletions recipes/proxy/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.0.0":
folder: all
"2.4.0":
folder: all
"2.3.2":
Expand Down
Loading