Made dlib::file implicitly convertible to std::string.

This commit is contained in:
Davis King 2013-11-29 18:21:52 -05:00
parent 454c2ea121
commit 520b7c30db
3 changed files with 14 additions and 0 deletions

View File

@ -101,6 +101,9 @@ namespace dlib
inline const std::string& full_name ( inline const std::string& full_name (
) const { return state.full_name; } ) const { return state.full_name; }
operator std::string (
) const { return full_name(); }
inline uint64 size ( inline uint64 size (
) const { return state.file_size; } ) const { return state.file_size; }

View File

@ -109,6 +109,9 @@ namespace dlib
inline uint64 size ( inline uint64 size (
) const { return state.file_size; } ) const { return state.file_size; }
operator std::string (
) const { return full_name(); }
bool operator == ( bool operator == (
const file& rhs const file& rhs
) const; ) const;

View File

@ -139,6 +139,14 @@ namespace dlib
- returns the size of this file in bytes. - returns the size of this file in bytes.
!*/ !*/
operator std::string (
) const;
/*!
ensures
- returns full_name()
(i.e. provides an implicit conversion to string from dlib::file)
!*/
file& operator= ( file& operator= (
const file& rhs const file& rhs
); );