Disallow implicit pointer conversion from rvalue smart pointers

This commit is contained in:
Kp 2015-01-29 00:58:53 +00:00
parent 7b0442e238
commit 9a36b82d5d
2 changed files with 13 additions and 1 deletions

View file

@ -453,7 +453,16 @@ class RAIIPHYSFS_File : public std::unique_ptr<PHYSFS_File, PHYSFS_File_deleter>
public:
DXX_INHERIT_CONSTRUCTORS(RAIIPHYSFS_File, base_t);
using base_t::operator bool;
operator PHYSFS_File *() const { return get(); }
#ifdef DXX_HAVE_CXX11_REF_QUALIFIER
operator PHYSFS_File *() const && = delete;
#endif
operator PHYSFS_File *() const
#ifdef DXX_HAVE_CXX11_REF_QUALIFIER
&
#endif
{
return get();
}
int close()
{
/* Like reset(), but returns result */

View file

@ -120,6 +120,9 @@ public:
{
return operator[](static_cast<std::size_t>(i));
}
#ifdef DXX_HAVE_CXX11_REF_QUALIFIER
operator pointer() const && = delete;
#endif
operator pointer() const
#ifdef DXX_HAVE_CXX11_REF_QUALIFIER
&