{"id":15047262,"url":"https://github.com/martinmoene/value-ptr-lite","last_synced_at":"2025-04-10T00:50:55.958Z","repository":{"id":53744760,"uuid":"92579893","full_name":"martinmoene/value-ptr-lite","owner":"martinmoene","description":"value-ptr-lite - A C++ smart-pointer with value semantics for C++98, C++11 and later in a single-file header-only  library","archived":false,"fork":false,"pushed_at":"2024-06-01T15:29:49.000Z","size":175,"stargazers_count":48,"open_issues_count":5,"forks_count":14,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-10T00:50:54.542Z","etag":null,"topics":["cpp11","cpp98","header-only","no-dependencies","single-file","smart-pointer"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/martinmoene.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-27T07:22:27.000Z","updated_at":"2024-06-01T15:29:52.000Z","dependencies_parsed_at":"2024-09-28T23:40:41.937Z","dependency_job_id":null,"html_url":"https://github.com/martinmoene/value-ptr-lite","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinmoene%2Fvalue-ptr-lite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinmoene%2Fvalue-ptr-lite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinmoene%2Fvalue-ptr-lite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/martinmoene%2Fvalue-ptr-lite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/martinmoene","download_url":"https://codeload.github.com/martinmoene/value-ptr-lite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137999,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp11","cpp98","header-only","no-dependencies","single-file","smart-pointer"],"created_at":"2024-09-24T20:55:51.030Z","updated_at":"2025-04-10T00:50:55.932Z","avatar_url":"https://github.com/martinmoene.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# value-ptr lite: A C++ smart-pointer with value semantics for C++98, C++11 and later\n\n**Note**: You may want to consider using [*indirect\\_value lite (p1950)*](https://github.com/martinmoene/indirect-value-lite) instead of *value\\_ptr lite*.\n\n[![Language](https://img.shields.io/badge/C%2B%2B-98/11/14/17-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) [![License](https://img.shields.io/badge/license-BSL-blue.svg)](https://opensource.org/licenses/BSL-1.0) [![Build Status](https://github.com/martinmoene/value-ptr-lite/actions/workflows/ci.yml/badge.svg)](https://github.com/martinmoene/value-ptr-lite/actions/workflows/ci.yml) [![Build status](https://ci.appveyor.com/api/projects/status/w2dgn3fxyrd6vcq8?svg=true)](https://ci.appveyor.com/project/martinmoene/value-ptr-lite) [![Version](https://badge.fury.io/gh/martinmoene%2Fvalue-ptr-lite.svg)](https://github.com/martinmoene/value-ptr-lite/releases) [![download](https://img.shields.io/badge/latest-download-blue.svg)](https://raw.githubusercontent.com/martinmoene/value-ptr-lite/master/include/nonstd/value_ptr.hpp) [![Conan](https://img.shields.io/badge/on-conan-blue.svg)](https://bintray.com/martinmoene/nonstd-lite/value-ptr-lite%3Anonstd-lite/_latestVersion) [![Vcpkg](https://img.shields.io/badge/on-vcpkg-blue.svg)](https://vcpkg.link/ports/value-ptr-lite) [![Try it on godbolt online](https://img.shields.io/badge/on-godbolt-blue.svg)](https://godbolt.org/z/cjdGue)\n\n\n**Contents**\n- [Example usage](#example-usage)\n- [In a nutshell](#in-a-nutshell)\n- [Dependencies](#dependencies)\n- [Installation](#installation)\n- [Synopsis](#synopsis)\n- [Reported to work with](#reported-to-work-with)\n- [Building tests and examples](#building-tests-and-examples)\n- [Other value_ptr implementations](#other-value-ptr-implementations)\n- [Notes and references](#notes-and-references)\n- [Appendix](#appendix)\n\n\nPimpl example usage\n-------------------\n\n```Cpp\n// in header file:\n\n#include \"nonstd/value_ptr.hpp\"\n\n// Thanks to value_ptr we get value semantics for free:\n\nstruct Widget\n{\n   Widget( int x );\n\n   int next();\n\n   struct Pimpl;\n   nonstd::value_ptr\u003cPimpl\u003e ptr;\n};\n\n// in source file:\n\nstruct Widget::Pimpl\n{\n    int x;\n\n    Pimpl( int v ) : x( v ) {}\n\n    int next() { return ++x; }\n};\n\n\nWidget::Widget( int x ) : ptr( Widget::Pimpl( x ) ) {}  // or: ptr( x )\n\nint Widget::next() { return ptr-\u003enext(); }\n\nint main()\n{\n    Widget w1( 42 );\n    Widget w2( w1 );\n\n    assert( w1.next() == 43 );\n    assert( w2.next() == 43 );\n}\n```\n\nIn a nutshell\n-------------\n**value-ptr lite** is a single-file header-only library to bring value semantics to heap resources. In certain situations, such as with the pimpl idiom in the example above, a pointer must be used while value semantics would be preferred. This is where `value_ptr` comes into play. A `value_ptr` is similar to a `std::optional` in many respects and one could say a `value_ptr` is more value than pointer.\n\nThis work is inspired on `value_ptr` by Gaetano Checinski [[1]](#ref1) and on `impl_ptr` by Andrey Upadyshev [[2]](#ref2).\n\n**Features and properties of value-ptr lite** are ease of installation (single header), freedom of dependencies other than the standard library. *value-ptr lite* shares the approach to in-place tags with any-lite, optional-lite and with variant-lite and these libraries can be used together.\n\n**Limitations of value-ptr lite** are ... .\n\n\nLicense\n-------\n*value-ptr lite* is distributed under the [Boost Software License](LICENSE.txt).\n\nDependencies\n------------\n*value-ptr lite* has no other dependencies than the [C++ standard library](http://en.cppreference.com/w/cpp/header).\n\n\nInstallation\n------------\n*value-ptr lite* is a single-file header-only library. Put `value_ptr.hpp` in the [include](include) folder directly into the project source tree or somewhere reachable from your project.\n\n\nSynopsis\n--------\n\n**Contents**\n- [Types in namespace nonstd](#types-in-namespace-nonstd)\n- [Interface of *value-ptr lite*](#interface-of-value-ptr-lite)\n- [Non-member functions for *value-ptr lite*](#non-member-functions-for-value-ptr-lite)\n- [Configuration macros](#configuration-macros)\n\n### Types in namespace nonstd\n\n| Purpose          |[[1]](#ref1) | [[2]](#ref2)| Type | Notes |\n|------------------|:-----------:|:------:|------|-------|\n| Smart pointer with\u003cbr\u003evalue semantics |\u0026#10003;|\u0026#10003;| class **value_ptr**  | [2]: impl_ptr |\n| Error reporting       |\u0026ndash; |\u0026ndash; | class **bad_value_access**           | \u0026nbsp; |\n| In-place construction |\u0026ndash; |\u0026ndash; | struct **in_place_tag**              | \u0026nbsp; |\n| \u0026nbsp;                |\u0026ndash; |\u0026ndash; | **in_place**                         | select type or index for in-place construction |\n| \u0026nbsp;                |\u0026ndash; |\u0026ndash; | **nonstd_lite_in_place_type_t**( T)  | macro for alias template in_place_type_t\u0026lt;T\u003e  |\n| \u0026nbsp;                |\u0026ndash; |\u0026ndash; | **nonstd_lite_in_place_index_t**( T )| macro for alias template in_place_index_t\u0026lt;T\u003e |\n\n### Interface of *value-ptr lite*\n\n#### Class `value_ptr`\n\n| Kind      |[[1]](#ref1) | [[2]](#ref2)|std| Type / Method | Note / Result |\n|-----------|:-----------:|:------:|--------|------------|---------------|\n| Value types    |\u0026#10003;|\u0026#10003;| \u0026nbsp; | **element_type**    |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| \u0026nbsp; | **pointer**         |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | **reference**       |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | **const_pointer**   |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | **const_reference** |\u0026nbsp; |\n| Lifetime types |\u0026#10003;|\u0026ndash; | \u0026nbsp; | **cloner_type**     |[2]: copier_type |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| \u0026nbsp; | **deleter_type**    |\u0026nbsp; |\n| Construction   |\u0026#10003;|\u0026#10003;| \u0026nbsp; | **value_ptr**() noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026#10003;| C++11  | **value_ptr**( std::nullptr_t ) noexcept|\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026ndash; | \u0026nbsp; | **value_ptr**( pointer p ) noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| \u0026nbsp; | **value_ptr**( value_ptr const \u0026 other ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| C++11  | **value_ptr**( value_ptr \u0026\u0026 other ) noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|    1   | \u0026nbsp; | **value_ptr**( element_type const \u0026 value ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|    1   | C++11  | **value_ptr**( element_type \u0026\u0026 value ) noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | C++11  | template\u003c class... Args \u003e\u003cbr\u003eexplicit **value_ptr**( in_place_type_t(T), Args\u0026\u0026... args ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | C++11  | template\u003c class U, class... Args \u003e\u003cbr\u003eexplicit **value_ptr**( in_place_type_t(T), std::initializer_list\u0026lt;U\u003e il, Args\u0026\u0026... args ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026ndash; | \u0026nbsp; | **value_ptr**( cloner_type const \u0026 cloner ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026ndash; | C++11  | **value_ptr**( cloner_type \u0026\u0026 cloner ) noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | **value_ptr**( deleter_type const \u0026 deleter ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | C++11  | **value_ptr**( deleter_type \u0026\u0026 deleter ) noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026ndash; | C++11  | template\u003c class V, class ClonerOrDeleter \u003e\u003cbr\u003e**value_ptr**( V \u0026\u0026 value, ClonerOrDeleter \u0026\u0026 cloner_or_deleter ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; |\u003cC++11  | template\u003c class V, class ClonerOrDeleter \u003e\u003cbr\u003e**value_ptr**( V const \u0026 value, ClonerOrDeleter const \u0026 cloner_or_deleter ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026ndash; | C++11  | template\u003c class V, class C, class D \u003e\u003cbr\u003e**value_ptr**( V \u0026\u0026 value, C \u0026\u0026 cloner, D \u0026\u0026 deleter ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; |\u003cC++11  | template\u003c class V, class C, class D \u003e\u003cbr\u003e**value_ptr**( V const \u0026 value, C const \u0026 cloner, D const \u0026 deleter ) |\u0026nbsp; |\n| Destruction    |\u0026ndash; |\u0026ndash; | C++11  | **~value_ptr**() |\u0026nbsp; |\n| Assignment     |\u0026ndash; |\u0026ndash; | C++11  | value_ptr \u0026 **operator=**( std::nullptr_t ) noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | value_ptr \u0026 **operator=**( T const \u0026 value ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | C++11  | template\u003c class U, ... \u003e\u003cbr\u003evalue_ptr \u0026 **operator=**( U \u0026\u0026 value ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026#10003;| \u0026nbsp; | value_ptr \u0026 **operator=**( value_ptr const \u0026 rhs ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026#10003;| C++11  | value_ptr \u0026 **operator=**( value_ptr \u0026\u0026 rhs ) noexcept |\u0026nbsp; |\n| Emplace        |\u0026ndash; |\u0026ndash; | C++11  | template\u003c class... Args \u003e\u003cbr\u003evoid **emplace**( Args\u0026\u0026... args ) |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | C++11  | template\u003c class U, class... Args \u003e\u003cbr\u003evoid **emplace**( std::initializer_list\u0026lt;U\u003e il, Args\u0026\u0026... args ) |\u0026nbsp; |\n| Observers      |\u0026#10003;|\u0026#10003;| \u0026nbsp; | pointer **get**() noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| \u0026nbsp; | cloner_type \u0026 **get_cloner**() noexcept |[2]: get_copier() |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| \u0026nbsp; | deleter_type \u0026 **get_deleter**() noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| \u0026nbsp; | reference **operator\\***() const |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| \u0026nbsp; | pointer **operator-\u003e**() const noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026#10003;|\u0026#10003;| C++11  | explicit operator **bool**() const noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; |\u003cC++11  | operator **safe_bool**() const noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | bool **has_value**() const nsvp_noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | element_type const \u0026 **value**() const |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | element_type \u0026 **value**() |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | C++11  | template\u003c class U \u003e\u003cbr\u003econstexpr element_type **value_or**( U \u0026\u0026 v ) const |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; |\u003cC++11  | template\u003c class U \u003e\u003cbr\u003econstexpr element_type **value_or**( U const \u0026 v ) const |\u0026nbsp; |\n| Modifiers      |\u0026#10003;|\u0026#10003;| \u0026nbsp; | pointer **release**() noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026ndash; | \u0026nbsp; | void **reset**( pointer p = pointer() ) noexcept |\u0026nbsp; |\n| \u0026nbsp;         |\u0026ndash; |\u0026#10003;| \u0026nbsp; | void **swap**( value_ptr \u0026 other ) noexcept |\u0026nbsp; |\n\n**Notes:**\u003cbr\u003e\n1. [2] has various converting constructors.\n\n### Non-member functions for *value-ptr lite*\n\n| Kind                 |[[1]](#ref1)| [[2]](#ref2)| std  | Function |\n|--------------------------|:------:|:------:|:----:|----------|\n| Relational operators     |\u0026ndash; |\u0026#10003;|\u0026nbsp;| template\u003c ... \u003e\u003cbr\u003ebool operator **_op_**( value_ptr\u003c...\u003e const \u0026 lhs, value_ptr\u003c...\u003e const \u0026 rhs ) |\n| \u0026nbsp;                   |\u0026ndash; |\u0026#10003;|C++11 | template\u003c ... \u003e\u003cbr\u003ebool operator **_op_**( value_ptr\u003c...\u003e const \u0026 lhs, std::nullptr_t ) |\n| \u0026nbsp;                   |\u0026ndash; |\u0026#10003;|C++11 | template\u003c ... \u003e\u003cbr\u003ebool operator **_op_**( std::nullptr_t, value_ptr\u003c...\u003e const \u0026 rhs ) |\n| \u0026nbsp;                   |\u0026ndash; |\u0026ndash; |\u0026nbsp;| template\u003c ... \u003e\u003cbr\u003ebool operator **_op_**( value_ptr\u003c...\u003e const \u0026 lhs, T const \u0026 value ) |\n| \u0026nbsp;                   |\u0026ndash; |\u0026ndash; |\u0026nbsp;| template\u003c ... \u003e\u003cbr\u003ebool operator **_op_**( T const \u0026 value, value_ptr\u003c...\u003e const \u0026 rhs ) |\n| Swap                     |\u0026ndash; |\u0026#10003;|\u0026nbsp;| template\u003c class T, class C, class D \u003e\u003cbr\u003evoid **swap**( value_ptr\u0026lt;T,C,D\u003e \u0026 x, value_ptr\u0026lt;T,C,D\u003e \u0026 y ) noexcept(...) |\n| Create                   |\u0026ndash; |\u0026ndash; |\u003cC++11| template\u003c class T, class C, class D \u003e\u003cbr\u003evalue_ptr\u0026lt;T,C,D\u003e **make_value**( T const \u0026 v )      |\n| \u0026nbsp;                   |\u0026ndash; |\u0026ndash; | C++11| template\u003c class T \u003e\u003cbr\u003evalue_ptr\u003c typename std::decay\u0026lt;T\u003e::type \u003e **make_value**( T \u0026\u0026 v ) |\n| \u0026nbsp;                   |\u0026ndash; |\u0026ndash; | C++11| template\u003c class T, class...Args \u003e\u003cbr\u003evalue_ptr\u0026lt;T,C,D\u003e **make_value**( Args\u0026\u0026... args ) |\n| \u0026nbsp;                   |\u0026ndash; |\u0026ndash; | C++11| template\u003c class T, class U, class... Args \u003e\u003cbr\u003evalue_ptr\u0026lt;T,C,D\u003e **make_value**( std::initializer_list\u0026lt;U\u003e il, Args\u0026\u0026... args ) |\n| Hash                     |\u0026ndash; |\u0026#10003;| C++11| template\u003c class T \u003e\u003cbr\u003eclass **hash**\u003c nonstd::value_ptr\u0026lt;T,C,D\u003e \u003e |\n\n\n### Configuration macros\n\n#### Standard selection macro\n-D\u003cb\u003ensvp\\_CPLUSPLUS\u003c/b\u003e=199711L  \nDefine this macro to override the auto-detection of the supported C++ standard, if your compiler does not set the `__cpluplus` macro correctly.\n\n#### Compare pointers\n-D\u003cb\u003ensvp_CONFIG_COMPARE_POINTERS\u003c/b\u003e=0  \nDefine this to 1 to compare `value_ptr`'s pointer instead of the content it's pointing to. Default is 0.\n\n#### Disable exceptions\n-D\u003cb\u003ensvp_CONFIG_NO_EXCEPTIONS\u003c/b\u003e=0  \nDefine this to 1 if you want to compile without exceptions. If not defined, the header tries and detect if exceptions have been disabled (e.g. via `-fno-exceptions`). Default is undefined.\n\n\nReported to work with\n---------------------\nThe table below mentions the compiler versions *value-ptr lite* is reported to work with.\n\nOS        | Compiler   | Versions |\n---------:|:-----------|:---------|\nWindows   | Clang/LLVM | ? |\n\u0026nbsp;    | GCC        | 5.2.0, 6.3.0 |\n\u0026nbsp;    | Visual C++\u003cbr\u003e(Visual Studio)| 8 (2005), 10 (2010), 11 (2012),\u003cbr\u003e12 (2013), 14 (2015, 2017) |\nGNU/Linux | Clang/LLVM | 3.1.0 - 4.0.0 (Wandbox) |\n\u0026nbsp;    | GCC        | 4.4.7 - 7.1.0 (Wandbox) |\nOS X      | ?          | ?   |\n\n\nBuilding tests and examples\n---------------------------\nTo build the tests and examples you need:\n\n- [Buck](https://buckbuild.com/) or [CMake](http://cmake.org) version 2.8.12 or later to be installed and in your PATH.\n- A [suitable compiler](#reported-to-work-with).\n\nThe [*lest* test framework](https://github.com/martinmoene/lest)  is included in the [test folder](test).\n\nThe following steps assume that the [*value_ptr lite* source code](https://github.com/martinmoene/value-ptr-lite) has been cloned into a directory named `value-ptr-lite`.\n\n### Buck\n\nTo run the tests and examples:\n```\nvalue-ptr-lite\u003e buck run test\nvalue-ptr-lite\u003e buck run example:01-pimpl\nvalue-ptr-lite\u003e buck run example:02-tree\n```\n\n### CMake\n\n1. Create a directory for the build outputs for a particular architecture.\nHere we use `value-ptr-lite/build`.\n\n        value-ptr-lite\u003e mkdir build \u0026\u0026 cd build\n\n2. Configure CMake to use the compiler of your choice (run `cmake --help` for a list).\n\n        value-ptr-lite/build\u003e cmake -G \"Unix Makefiles\" [see 3. below] ..\n\n3. Optional. You can control above configuration through the following options:\n   - `-DVALUE_PTR_LITE_BUILD_TEST=ON`: build the tests for lest, default off\n   - `-DVALUE_PTR_LITE_BUILD_EXAMPLE=ON`: build the examples, default off\n   - `-DVALUE_PTR_LITE_COLOURISE_TEST=ON`: use colour for pass, fail, default off\n\n4. Build the test suite. With Visual Studio, append the configuration as `--config Debug` or `--config Release`.\n\n        value-ptr-lite/build\u003e cmake --build .\n\n5. Run the test suite.\n\n        value-ptr-lite/build\u003e ctest -V\n\nAll tests should pass, indicating your platform is supported and you are ready to use *value-ptr lite*. See the table with [supported types and functions](#features).\n\n\nOther value-ptr implementations\n-------------------------------\n- LoopPerfect. [valuable: A C++ smart-pointer with value-semantics](https://github.com/LoopPerfect/valuable) (C++14).  \n- Jonathan B. Coe. [indirect_value: An indirect value-type for C++ (perfect-pimpl)](https://github.com/jbcoe/indirect_value).  \n- [Search _value ptr_ on GitHub](https://github.com/search?l=C%2B%2B\u0026q=value_ptr\u0026type=Repositories).\n\n\nNotes and references\n--------------------\n\n\u003ca id=\"ref1\"\u003e\u003c/a\u003e[1] Gaetano Checinski. [value_ptr — The Missing C++ Smart-pointer](https://hackernoon.com/value-ptr-the-missing-c-smart-pointer-1f515664153e) ([GitHub](https://github.com/LoopPerfect/valuable)). May 2017.  \n\u003ca id=\"ref2\"\u003e\u003c/a\u003e[2] Andrey Upadyshev. [PIMPL, Rule of Zero and Scott Meyers](http://oliora.github.io/2015/12/29/pimpl-and-rule-of-zero.html) ([GitHub](https://github.com/oliora/samples/blob/master/spimpl.h)). December 29, 2015.  \n\u003ca id=\"ref3\"\u003e\u003c/a\u003e[3] [p0201 - A polymorphic value-type for C++](https://wg21.link/p0201). March 2019.  \n\u003ca id=\"ref4\"\u003e\u003c/a\u003e[4] [p1950 - indirect_value: A Free-Store-Allocated Value Type For C++](https://wg21.link/p1950). October 2022.  \n\nAppendix\n--------\n\n### A.1 Compile-time information\n\nThe version of *value-ptr lite* is available via tag `[.version]`. The following tags are available for information on the compiler and on the C++ standard library used: `[.compiler]`, `[.stdc++]`, `[.stdlanguage]` and `[.stdlibrary]`.\n\n### A.2 Value-ptr lite test specification\n\n```\nvalue_ptr: Allows to default construct an empty value_ptr\nvalue_ptr: Allows to explicitly construct a disengaged, empty value_ptr via nullptr\nvalue_ptr: Allows to default construct an empty value_ptr with a non-default-constructible\nvalue_ptr: Allows to copy-construct from empty value_ptr\nvalue_ptr: Allows to copy-construct from non-empty value_ptr\nvalue_ptr: Allows to move-construct from value_ptr (C++11)\nvalue_ptr: Allows to copy-construct from literal value\nvalue_ptr: Allows to copy-construct from value\nvalue_ptr: Allows to move-construct from value (C++11)\nvalue_ptr: Allows to in-place construct from literal value (C++11)\nvalue_ptr: Allows to in-place copy-construct from value (C++11)\nvalue_ptr: Allows to in-place move-construct from value (C++11)\nvalue_ptr: Allows to in-place copy-construct from initializer-list (C++11)\nvalue_ptr: Allows to in-place move-construct from initializer-list (C++11)\nvalue_ptr: Allows to construct from pointer to value\nvalue_ptr: Allows to assign nullptr to disengage (C++11)\nvalue_ptr: Allows to copy-assign from/to engaged and disengaged value_ptr-s\nvalue_ptr: Allows to move-assign from/to engaged and disengaged value_ptr-s (C++11)\nvalue_ptr: Allows to copy-assign from literal value\nvalue_ptr: Allows to copy-assign from value\nvalue_ptr: Allows to move-assign from value (C++11)\nvalue_ptr: Allows to copy-emplace content from arguments (C++11)\nvalue_ptr: Allows to move-emplace content from arguments (C++11)\nvalue_ptr: Allows to copy-emplace content from intializer-list and arguments (C++11)\nvalue_ptr: Allows to move-emplace content from intializer-list and arguments (C++11)\nvalue_ptr: Allows to construct and destroy via user-specified cloner and deleter\nvalue_ptr: Allows to construct via user-specified cloner with member data\nvalue_ptr: Allows to obtain pointer to value via operator-\u003e()\nvalue_ptr: Allows to obtain value via operator*()\nvalue_ptr: Allows to obtain moved-value via operator*()\nvalue_ptr: Allows to obtain engaged state via operator bool()\nvalue_ptr: Allows to obtain engaged state via has_value()\nvalue_ptr: Allows to obtain value via value()\nvalue_ptr: Allows to obtain value or default via value_or()\nvalue_ptr: Allows to obtain moved-default via value_or() (C++11)\nvalue_ptr: Throws bad_value_access at disengaged access\nvalue_ptr: Allows to release its content\nvalue_ptr: Allows to clear its content (reset)\nvalue_ptr: Allows to replace its content (reset)\nvalue_ptr: Allows to swap with other value_ptr (member)\nvalue_ptr: Allows to swap with other value_ptr (non-member)\nvalue_ptr: Provides relational operators (non-member, pointer comparison: nsvp_CONFIG_COMPARE_POINTERS!=0)\nvalue_ptr: Provides relational operators (non-member, value comparison: nsvp_CONFIG_COMPARE_POINTERS==0)\nvalue_ptr: Provides relational operators (non-member, mixed value comparison: nsvp_CONFIG_COMPARE_POINTERS==0)\nmake_value: Allows to copy-construct value_ptr\nmake_value: Allows to move-construct value_ptr (C++11)\nmake_value: Allows to in-place copy-construct value_ptr from arguments (C++11)\nmake_value: Allows to in-place move-construct value_ptr from arguments (C++11)\nmake_value: Allows to in-place copy-construct value_ptr from initializer-list and arguments (C++11)\nmake_value: Allows to in-place move-construct value_ptr from initializer-list and arguments (C++11)\nstd::hash\u003c\u003e: Allows to obtain hash (C++11)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinmoene%2Fvalue-ptr-lite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmartinmoene%2Fvalue-ptr-lite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmartinmoene%2Fvalue-ptr-lite/lists"}