Libmagicxx v5.1.1
A C++ wrapper library over the Magic Number Recognition Library.
Loading...
Searching...
No Matches
file_concepts.hpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: Copyright (c) 2022-2024 Oğuz Toraman <oguz.toraman@tutanota.com> */
2/* SPDX-License-Identifier: LGPL-3.0-only */
3
4#ifndef FILE_CONCEPTS_HPP
5#define FILE_CONCEPTS_HPP
6
7#include <filesystem>
8
9#include "utility.hpp"
10
11namespace file_concepts {
12
17template <typename ContainerType>
19 requires (ContainerType c, std::filesystem::path p){
20 c.push_back(p);
21 c.empty();
22 typename ContainerType::value_type;
23 } &&
24 std::ranges::range<ContainerType> &&
25 std::default_initializable<ContainerType> &&
26 std::same_as<typename ContainerType::value_type, std::filesystem::path>;
27
36[[nodiscard]]
37inline std::string to_string(const file_container auto& container, const std::string& separator = ", ")
38{
39 return utility::to_string(container, separator,
40 [](const std::filesystem::path& path){
41 return path.string();
42 }
43 );
44}
45
46} /* namespace file_concepts */
47
48#endif /* FILE_CONCEPTS_HPP */
The file_container concept specifies the requirements of a container which can be used as a file cont...
Definition file_concepts.hpp:18
Definition file_concepts.hpp:11
std::string to_string(const file_container auto &container, const std::string &separator=", ")
Convert the file container to a string.
Definition file_concepts.hpp:37
std::string to_string(const ContainerType &container, const std::string &value_separator, StringConverterType string_converter)
Convert any container to string using the string_converter.
Definition utility.hpp:30