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 77fd1ca commit efebfbf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 20 deletions.
26 changes: 16 additions & 10 deletions reference.in/virtual_ptr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,33 +470,39 @@ using yorel::yomm2::virtual_shared_ptr;

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

define_method(void, kick, (const virtual_shared_ptr<Dog>& dog, std::ostream& os)) {
define_method(void, kick, (
const virtual_shared_ptr<Dog>& dog, std::ostream& os)) {
os << "bark";
}

define_method(void, kick, (const virtual_shared_ptr<Cat>& cat, std::ostream& os)) {
define_method(void, kick, (
const virtual_shared_ptr<Cat>& cat, std::ostream& os)) {
os << "hiss";
}

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";
}

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

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
26 changes: 16 additions & 10 deletions reference/virtual_ptr.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,33 +431,39 @@ using yorel::yomm2::virtual_shared_ptr;
declare_method(void, kick, (const virtual_shared_ptr<Animal>&, std::ostream&));
define_method(void, kick, (const virtual_shared_ptr<Dog>& dog, std::ostream& os)) {
define_method(void, kick, (
const virtual_shared_ptr<Dog>& dog, std::ostream& os)) {
os << "bark";
}
define_method(void, kick, (const virtual_shared_ptr<Cat>& cat, std::ostream& os)) {
define_method(void, kick, (
const virtual_shared_ptr<Cat>& cat, std::ostream& os)) {
os << "hiss";
}
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";
}
define_method(
void, meet,
(const virtual_shared_ptr<Cat>& a, const virtual_shared_ptr<Dog>& b, std::ostream& os)) {
void, meet, (
const virtual_shared_ptr<Cat>& a,
const virtual_shared_ptr<Dog>& b, std::ostream& os)) {
os << "run";
}
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 efebfbf

Please sign in to comment.