Stores result of an operation. It always contains status and optionally can contain value.  
 More...
#include <libpmemkv.hpp>
 | 
|   | result (const T &val) noexcept(noexcept(T(std::declval< T >()))) | 
|   | Creates result with value (status is automatically initialized to status::OK).  More...
  | 
|   | 
|   | result (const status &err) noexcept | 
|   | Creates result which contains only status.  More...
  | 
|   | 
|   | result (const result &other) noexcept(noexcept(T(std::declval< T >()))) | 
|   | Default copy constructor.  More...
  | 
|   | 
|   | result (result &&other) noexcept(noexcept(T(std::declval< T >()))) | 
|   | Default move constructor.  More...
  | 
|   | 
|   | result (T &&val) noexcept(noexcept(T(std::declval< T >()))) | 
|   | Constructor with rvalue reference to T.  More...
  | 
|   | 
|   | ~result () | 
|   | Explicit destructor.  More...
  | 
|   | 
| result &  | operator= (const result &other) noexcept(noexcept(std::declval< T >().~T()) &&noexcept(T(std::declval< T >()))) | 
|   | Default copy assignment operator.  More...
  | 
|   | 
| result &  | operator= (result &&other) noexcept(noexcept(std::declval< T >().~T()) &&noexcept(T(std::declval< T >()))) | 
|   | Default move assignment operator.  More...
  | 
|   | 
| bool  | is_ok () const noexcept | 
|   | Checks if the result contains value (status == status::OK).  More...
  | 
|   | 
| const T &  | get_value () const & | 
|   | Returns const reference to value from the result.  More...
  | 
|   | 
| T &  | get_value () & | 
|   | Returns reference to value from the result.  More...
  | 
|   | 
| T &&  | get_value () && | 
|   | Returns rvalue reference to value from the result.  More...
  | 
|   | 
| status  | get_status () const noexcept | 
|   | Returns status from the result.  More...
  | 
|   | 
template<typename T>
class pmem::kv::result< T >
Stores result of an operation. It always contains status and optionally can contain value. 
If result contains value: is_ok() returns true, get_value() returns value, get_status() returns status::OK.
If result contains error: is_ok() returns false, get_value() throws bad_result_access, get_status() returns status other than status::OK. 
 
◆ result() [1/5]
Creates result with value (status is automatically initialized to status::OK). 
- Parameters
 - 
  
  
 
 
 
◆ result() [2/5]
Creates result which contains only status. 
- Parameters
 - 
  
  
 
 
 
◆ result() [3/5]
Default copy constructor. 
- Parameters
 - 
  
  
 
 
 
◆ result() [4/5]
Default move constructor. 
- Parameters
 - 
  
  
 
 
 
◆ result() [5/5]
Constructor with rvalue reference to T. 
- Parameters
 - 
  
    | [in] | val | rvalue reference to T  | 
  
   
 
 
◆ ~result()
◆ get_status()
Returns status from the result. 
It returns status::OK if there is a value, and other status (with the appropriate 'error') if there isn't any value.
- Returns
 - status 
 
 
 
◆ get_value() [1/3]
Returns reference to value from the result. 
If result doesn't contain value, throws bad_result_access.
- Exceptions
 - 
  
  
 
- Returns
 - reference to value from the result 
 
 
 
◆ get_value() [2/3]
Returns rvalue reference to value from the result. 
If result doesn't contain value, throws bad_result_access.
- Exceptions
 - 
  
  
 
- Returns
 - rvalue reference to value from the result 
 
 
 
◆ get_value() [3/3]
Returns const reference to value from the result. 
If result doesn't contain value, throws bad_result_access.
- Exceptions
 - 
  
  
 
- Returns
 - const reference to value from the result. 
 
 
 
◆ is_ok()
Checks if the result contains value (status == status::OK). 
- Returns
 - bool 
 
 
 
◆ operator=() [1/2]
Default copy assignment operator. 
- Parameters
 - 
  
  
 
 
 
◆ operator=() [2/2]
Default move assignment operator. 
- Parameters
 - 
  
  
 
 
 
◆ value
The documentation for this class was generated from the following file: