Class thrust::system::error_condition
The class error_condition
describes an object used to hold values identifying error conditions.
Note: error_condition
values are portable abstractions, while error_code
values are implementation specific.
#include <thrust/system/error_code.h>
class thrust::system::error_condition { public: error_condition();
error_condition(int val, const error_category & cat);
template <typename ErrorConditionEnum> error_condition(ErrorConditionEnum e, typename thrust::detail::enable_if< is_error_condition_enum< ErrorConditionEnum >::value >::type * = 0);
void assign(int val, const error_category & cat);
template <typename ErrorConditionEnum> thrust::detail::enable_if< is_error_condition_enum< ErrorConditionEnum >::value, error_condition >::type & operator=(ErrorConditionEnum e);
void clear();
int value() const;
const error_category & category() const;
std::string message() const;
operator bool() const; };
Member Functions
Function thrust::system::error_condition::error_condition
error_condition();
Constructs an object of type error_condition
.
Postconditions:
value() == 0
.category() == generic_category()
.
Function thrust::system::error_condition::error_condition
error_condition(int val, const error_category & cat);
Constructs an object of type error_condition
.
Postconditions:
value() == val
.category() == cat
.
Function thrust::system::error_condition::error_condition
template <typename ErrorConditionEnum> error_condition(ErrorConditionEnum e, typename thrust::detail::enable_if< is_error_condition_enum< ErrorConditionEnum >::value >::type * = 0);
Constructs an object of type error_condition
.
Note: This constructor shall not participate in overload resolution unless is_error_condition_enum<ErrorConditionEnum>::value
is true
.
Postconditions: *this == make_error_condition(e)
.
Function thrust::system::error_condition::assign
void assign(int val, const error_category & cat);
Assigns to this error_code
object from an error value and an error_category
.
Function Parameters:
val
The new value to return fromvalue()
.cat
The newerror_category
to return fromcategory()
.
Postconditions:
value() == val
.category() == cat
.
Function thrust::system::error_condition::operator=
template <typename ErrorConditionEnum> thrust::detail::enable_if< is_error_condition_enum< ErrorConditionEnum >::value, error_condition >::type & operator=(ErrorConditionEnum e);
Assigns to this error_code
object from an error condition enumeration.
Note: This operator shall not participate in overload resolution unless is_error_condition_enum<ErrorConditionEnum>::value
is true
.
Postconditions: *this == make_error_condition(e)
.
Returns: *this
Function thrust::system::error_condition::clear
void clear();
Clears this error_code
object.
Postconditions:
value == 0
category() == generic_category()
.
Function thrust::system::error_condition::value
int value() const;
Returns: The value encoded by this error_condition
.
Function thrust::system::error_condition::category
const error_category & category() const;
Returns: A const
reference to the error_category
encoded by this error_condition
.
Function thrust::system::error_condition::message
std::string message() const;
Returns: category().message(value())
.
Function thrust::system::error_condition::operator bool
operator bool() const;
Returns: value() != 0
.