is_empty Function

Indicates whether a specified path refers to an empty file or empty directory.

template<class Path>
inline bool is_empty(
   const Path& Pval
);

Parameters

  • Pval
    A Path object. Path can be either a basic_path or a type that is derived from basic_path.

Return Value

If Pval refers to an existing directory, the function returns basic_directory_iterator<Path>(Pval) == basic_directory_iterator<Path>().

If Pval refers to an existing file, the function returns file_size(Pval) == 0.

Remarks

If Pval refers to a path that does not exist, the function throws a basic_filesystem_error.

Requirements

Header: filesystem

Namespace: std::tr2::sys

See Also

Reference

<filesystem>

exists Function

basic_directory_iterator Class

file_size Function

Other Resources

C++ Standard Library Header Files