-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow creation of box and ref through std::unique_ptr and std::shared…
…_ptr respectively
- Loading branch information
1 parent
4fa84ff
commit 86f7312
Showing
6 changed files
with
76 additions
and
2 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,27 @@ | ||
#include <cassert> | ||
#include <iostream> | ||
#include <rfl.hpp> | ||
#include <rfl/json.hpp> | ||
#include <source_location> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "test_box.hpp" | ||
|
||
namespace test_box2 { | ||
|
||
void test() { | ||
std::cout << std::source_location::current().function_name() << std::endl; | ||
|
||
auto ptr = std::make_unique<std::string>("Hello World!"); | ||
const rfl::Result<rfl::Box<std::string>> box = | ||
rfl::make_box<std::string>(std::move(ptr)); | ||
|
||
if (box) { | ||
std::cout << "OK" << std::endl << std::endl; | ||
} else { | ||
std::cout << "Expected the result to be successful." << std::endl | ||
<< std::endl; | ||
} | ||
} | ||
} // namespace test_box2 |
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,4 @@ | ||
namespace test_box2 { | ||
void test(); | ||
} | ||
|
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