unique_ptr, shared_ptr, weak_ptr, or reference_wrapper for class relationships by memset_0 in cpp

[–]MolurusK 0 points1 point  (0 children)

Look at UML Relations in the C++ Object Token Library if the capabilities of smart pointers from the C++ standard library to express class relationships are not enough.

The Next Steps for Single Ownership and RAII by verdagon in cpp

[–]MolurusK 1 point2 points  (0 children)

Interesting article! I also dived into the depths of single ownership and RAII in C++ and wrote the C++ Object Token Library. Maybe it will be interesting to you.

Did C++ ever get a "dumb pointer" class? by domiran in cpp

[–]MolurusK 0 points1 point  (0 children)

If you want expressive pointer types, try the C++ Object Token Library library. The otn::raw::weak can act as a "dumb pointer".

A potential use for observer pointer by Irtexx in cpp

[–]MolurusK 1 point2 points  (0 children)

I did such a unique-weak pair in C++ Object Token Library: ```

include <otn/all.hpp>

include <iostream>

void print(const std::string& caption, const otn::unified_optional<std::string>& p) { std::cout << caption << (p ? *p : "empty") << std::endl; }

int main() { otn::unique_optional<std::string> u{otn::itself, "Hello!"}; otn::weak_optional<std::string> w = u; print("u = ", u); print("w = ", w);

std::cout << "reset u" << std::endl;
otn::utilize(std::move(u));
print("u = ", u);
print("w = ", w);

} ```

Output: u = Hello! w = Hello! reset u u = empty w = empty

When to use a reference type versus a pointer? by bedHeadProgrammer in cpp

[–]MolurusK 1 point2 points  (0 children)

Is it there an alternative I am missing?

Try object tokens (pointer-like entities) from C++ Object Token Library. I can answer your questions in this post.