Valuable
A C++ smart-pointer with value-semantics ๐
Install / Use
/learn @LoopPerfect/ValuableREADME
valuable ๐
A C++ library implementing value_ptr - a smart-pointer with value-semantics.
Value types are simple and intuitive. Unfortunately sometimes an implementation detail requires us to use pointers.
The standard library demonstrates how handy smart-pointers can be for encoding ownership and lifetime semantics, but none of the smart-pointers implement value-semantics.
This is why valuable::value_ptr was made.
Example
#include <string>
#include <valuable/value_ptr.hpp>
using namespace std;
using namespace valuable;
struct Tree {
string const name;
value_ptr<Tree> left;
value_ptr<Tree> right;
Tree(
string const& name,
value_ptr<Tree> const& left = value_ptr<Tree>{},
value_ptr<Tree> const& right = value_ptr<Tree>{})
: name{name}
, left{left}
, right{right}
{}
};
int main() {
Tree root = Tree{
"root",
Tree{"l"}
Tree{"r"}
};
root.left = root; // copy of root assigned to left
root.right = root; // and we don't have cyclic references
}
Installation
This library requires a C++ 14 compiler.
Buckaroo
Install with Buckaroo:
buckaroo add github.com/LoopPerfect/valuable
The Buck target is :valuable
Manual
Alternatively, you can copy & paste the headers into your include path:
cp valuable/include/*.hpp $InstallPath/include/valuable
QtCreator
You can also use Qt Creator for development. There's no need to build Google Test as it is built along with the test project. In the Build Steps, add the Google Test Git checkout path to the additional qmake arguments:
GOOGLETEST_PATH=d:/path/to/googletest
Contributing
We are accepting contributions! ๐
Before you submit a PR, please run the tests:
buck test //...
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot ๅฏๅชไฝๆถๅ่ฝๅใไฝฟ็จ <qqmedia> ๆ ็ญพ๏ผ็ณป็ปๆ นๆฎๆไปถๆฉๅฑๅ่ชๅจ่ฏๅซ็ฑปๅ๏ผๅพ็/่ฏญ้ณ/่ง้ข/ๆไปถ๏ผใ
