This repository was archived by the owner on Jan 29, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
samples/basic_facade_builder Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ struct StringDictionary : pro::facade_builder
2626 ::build {};
2727
2828struct MutableStringDictionary : pro::facade_builder
29- ::add_facade<StringDictionary>
29+ ::add_facade<StringDictionary, true >
3030 ::add_convention<MemEmplace, void (std::size_t key, std::string value)>
3131 ::build {};
3232
@@ -42,9 +42,11 @@ int main() {
4242 p1->emplace (123 , " lalala" );
4343 auto p2 = p1; // Performs a deep copy
4444 p2->emplace (456 , " trivial" );
45+ pro::proxy<StringDictionary> p3 = std::move (p2); // Performs an upward conversion from an rvalue reference
4546 std::cout << p1->size () << " \n " ; // Prints "1"
4647 std::cout << p1->at (123 ) << " \n " ; // Prints "lalala"
47- std::cout << p2->size () << " \n " ; // Prints "2"
48- std::cout << p2->at (123 ) << " \n " ; // Prints "lalala"
49- std::cout << p2->at (456 ) << " \n " ; // Prints "trivial"
48+ std::cout << std::boolalpha << p2.has_value () << " \n " ; // Prints "false" because it is moved
49+ std::cout << p3->size () << " \n " ; // Prints "2"
50+ std::cout << p3->at (123 ) << " \n " ; // Prints "lalala"
51+ std::cout << p3->at (456 ) << " \n " ; // Prints "trivial"
5052}
You can’t perform that action at this time.
0 commit comments