Libmagicxx v10.0.3
A modern C++23 wrapper for libmagic — the library that powers the Unix file command.
Loading...
Searching...
No Matches
Recognition::Utility::FileContainer Concept Reference

Concept for containers that can hold filesystem paths. More...

#include <utility.hpp>

Concept definition

template<typename ContainerT>
concept Recognition::Utility::FileContainer = std::ranges::range<ContainerT>
&& std::default_initializable<ContainerT>
&& std::same_as<
typename ContainerT::value_type,
std::filesystem::path
>
&& requires(ContainerT c, std::filesystem::path p) {
c.push_back(p);
c.empty();
typename ContainerT::value_type;
}
Concept for containers that can hold filesystem paths.
Definition utility.hpp:250

Detailed Description

Concept for containers that can hold filesystem paths.

A type satisfies FileContainer if:

  • It satisfies std::ranges::range
  • It is default-constructible
  • Its value_type is std::filesystem::path
  • It supports push_back() and empty() operations
Template Parameters
ContainerTThe container type to check.

Satisfying Types

  • std::vector<std::filesystem::path>
  • std::list<std::filesystem::path>
  • std::deque<std::filesystem::path>

Usage with Magic

std::vector<std::filesystem::path> files = {
"/path/to/file1.txt",
"/path/to/file2.png"
};
// Works because vector<path> satisfies FileContainer
auto results = magic.IdentifyFiles(files);
See also
Magic::IdentifyFiles()
Since
10.0.0