I\'m writing a network library and use move semantics heavily to handle ownership for file descriptors. One of my class wishes to receive file descriptor wrappers of other k
You can restrict T
to not be an lvalue reference, and thus prevent lvalues from binding to it:
#include
struct OwnershipReceiver
{
template ::value
>::type
>
void receive_ownership(T&& t)
{
// taking file descriptor of t, and clear t
}
};
It might also be a good idea to add some sort of restriction to T
such that it only accepts file descriptor wrappers.