![]() |
NEURON
|
A RAII wrapper for C-style strings. More...
#include <unique_cstr.hpp>
Public Member Functions | |
| unique_cstr ()=default | |
| unique_cstr (const unique_cstr &)=delete | |
| unique_cstr (unique_cstr &&other) noexcept | |
| unique_cstr & | operator= (const unique_cstr &)=delete |
| unique_cstr & | operator= (unique_cstr &&other) noexcept |
| unique_cstr (char *cstr) | |
| ~unique_cstr () | |
| char * | release () |
| Releases ownership of the string. More... | |
| char * | c_str () const |
| bool | is_valid () const |
Private Attributes | |
| char * | str_ = nullptr |
A RAII wrapper for C-style strings.
The string must be null-terminated and allocated with malloc. The lifetime of the string is bound to the life time of the unique_cstr. Certain patterns in NRN require passing on ownership, this is achieved using .release(), which returns the contained C-string and makes this object invalid.
Definition at line 18 of file unique_cstr.hpp.
|
default |
|
delete |
|
inlinenoexcept |
Definition at line 22 of file unique_cstr.hpp.
|
inlineexplicit |
Definition at line 33 of file unique_cstr.hpp.
|
inline |
Definition at line 36 of file unique_cstr.hpp.
|
inline |
Definition at line 48 of file unique_cstr.hpp.
|
inline |
Definition at line 51 of file unique_cstr.hpp.
|
delete |
|
inlinenoexcept |
Definition at line 27 of file unique_cstr.hpp.
|
inline |
Releases ownership of the string.
Returns the string and makes this object invalid.
Definition at line 44 of file unique_cstr.hpp.
|
private |
Definition at line 56 of file unique_cstr.hpp.