You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
282 B

#pragma once
#include <errno.h>
template<typename T>
static
inline
T
to_neg_errno(const T rv_,
const int errno_)
{
return ((rv_ == (T)-1) ? -errno_ : rv_);
}
template<typename T>
static
inline
T
to_neg_errno(const T rv_)
{
return ::to_neg_errno(rv_,errno);
}