Skip to content

Commit

Permalink
virtual_shared_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
jll63 committed Jul 16, 2023
1 parent b8ab8c9 commit 77fd1ca
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
18 changes: 11 additions & 7 deletions reference.in/virtual_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,11 @@ BOOST_AUTO_TEST_CASE(reference_virtual_ptr_final) {
Dog snoopy, hector;
Cat sylvester;

std::vector<virtual_ptr<Animal>> animals;
animals.emplace_back(virtual_ptr<Animal>::final(snoopy));
animals.emplace_back(virtual_ptr<Animal>::final(sylvester));
animals.emplace_back(virtual_ptr<Animal>::final(hector));
std::vector<virtual_ptr<Animal>> animals = {
virtual_ptr<Animal>::final(snoopy),
virtual_ptr<Animal>::final(sylvester),
virtual_ptr<Animal>::final(hector),
};

{
boost::test_tools::output_test_stream os;
Expand Down Expand Up @@ -478,10 +479,12 @@ define_method(void, kick, (const virtual_shared_ptr<Cat>& cat, std::ostream& os)
}

declare_method(
void, meet, (const virtual_shared_ptr<Animal>&, const virtual_shared_ptr<Animal>&, std::ostream&));
void, meet,
(const virtual_shared_ptr<Animal>&, const virtual_shared_ptr<Animal>&, std::ostream&));

define_method(
void, meet, (const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Dog>& b, std::ostream& os)) {
void, meet,
(const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Dog>& b, std::ostream& os)) {
os << "wag tail";
}

Expand All @@ -492,7 +495,8 @@ define_method(
}

define_method(
void, meet, (const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Cat>& b, std::ostream& os)) {
void, meet,
(const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Cat>& b, std::ostream& os)) {
os << "chase";
}

Expand Down
18 changes: 11 additions & 7 deletions reference/virtual_ptr.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,11 @@ BOOST_AUTO_TEST_CASE(reference_virtual_ptr_final) {
Dog snoopy, hector;
Cat sylvester;

std::vector<virtual_ptr<Animal>> animals;
animals.emplace_back(virtual_ptr<Animal>::final(snoopy));
animals.emplace_back(virtual_ptr<Animal>::final(sylvester));
animals.emplace_back(virtual_ptr<Animal>::final(hector));
std::vector<virtual_ptr<Animal>> animals = {
virtual_ptr<Animal>::final(snoopy),
virtual_ptr<Animal>::final(sylvester),
virtual_ptr<Animal>::final(hector),
};

{
boost::test_tools::output_test_stream os;
Expand Down Expand Up @@ -439,10 +440,12 @@ define_method(void, kick, (const virtual_shared_ptr<Cat>& cat, std::ostream& os)
}
declare_method(
void, meet, (const virtual_shared_ptr<Animal>&, const virtual_shared_ptr<Animal>&, std::ostream&));
void, meet,
(const virtual_shared_ptr<Animal>&, const virtual_shared_ptr<Animal>&, std::ostream&));
define_method(
void, meet, (const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Dog>& b, std::ostream& os)) {
void, meet,
(const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Dog>& b, std::ostream& os)) {
os << "wag tail";
}
Expand All @@ -453,7 +456,8 @@ define_method(
}
define_method(
void, meet, (const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Cat>& b, std::ostream& os)) {
void, meet,
(const virtual_shared_ptr<Dog>& a, const virtual_shared_ptr<Cat>& b, std::ostream& os)) {
os << "chase";
}
Expand Down

0 comments on commit 77fd1ca

Please sign in to comment.