|
cpp-mate
0.7
Helpful library for C++.
|
Represents some abstract resource which should be released. More...
#include <Resource.hpp>
Public Types | |
| using | Release = std::function< void(const T &resource)> |
Public Member Functions | |
| Resource (const Resource &)=delete | |
| Resource & | operator= (const Resource &)=delete |
| Resource (const T &resource, const Release &release) noexcept | |
| Constructor. More... | |
| Resource (Resource &&other) noexcept | |
| Constructor. More... | |
| ~Resource () | |
| T | get () const noexcept |
| Gets resource. More... | |
| void | set (const T &resource) noexcept |
| Sets a new resource without releasing a previous one. More... | |
| Resource & | operator= (Resource &&other) noexcept |
| operator = More... | |
| operator T () const noexcept | |
| Implicitly conversion to the resource itself. More... | |
| operator bool () const noexcept | |
| Implicitly conversion of the resource to a boolean value. e.g. for checks pointer. More... | |
| T | operator* () const noexcept |
| Operator to access the resource via asterisk symbol. More... | |
| Resource & | operator= (const T &resource) noexcept |
| operator = More... | |
Represents some abstract resource which should be released.
| using CppMate::Resource< T >::Release = std::function<void(const T& resource)> |
Release function type.
|
delete |
|
inlinenoexcept |
Constructor.
| resource | the resource to own. |
| release | release function. |
|
inlinenoexcept |
Constructor.
| other | another instance to move. |
|
inline |
Destructor.
|
inlinenoexcept |
Gets resource.
|
inlinenoexcept |
Implicitly conversion of the resource to a boolean value. e.g. for checks pointer.
|
inlinenoexcept |
Implicitly conversion to the resource itself.
|
inlinenoexcept |
Operator to access the resource via asterisk symbol.
|
delete |
|
inlinenoexcept |
operator =
| resource | new resource to set. |
|
inlinenoexcept |
operator =
| other | another resource to move. |
|
inlinenoexcept |
Sets a new resource without releasing a previous one.
| resource | new resource to set. |