0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::fs: Add boolean operators for fd.

This commit is contained in:
Jason Volk 2018-10-31 17:54:57 -07:00
parent 6b6106499f
commit c0e92eb2a1

View file

@ -29,10 +29,9 @@ struct ircd::fs::fd
int fdno{-1};
public:
operator const int &() const
{
return fdno;
}
operator const int &() const;
operator bool() const;
bool operator!() const;
fd(const string_view &path, const opts &);
fd(const string_view &path);
@ -69,3 +68,24 @@ struct ircd::fs::fd::opts
opts(const std::ios::openmode &);
opts() = default;
};
inline bool
ircd::fs::fd::operator!()
const
{
return !bool(*this);
}
inline ircd::fs::fd::operator
bool()
const
{
return int(*this) >= 0;
}
inline ircd::fs::fd::operator
const int &()
const
{
return fdno;
}