aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/dataloader/Dataloader.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-22 21:18:53 +0100
committer GitHub <noreply@github.com>2024-01-22 21:18:53 +0100
commit10f1f250883529e809d18a369f3668cfacd3bfd1 (patch)
tree7cd8a379963af18c24f8dabfe7525b39f2333e0c /src/openvic-simulation/dataloader/Dataloader.hpp
parent8205732a1b95f018f0898a2a4bc62e22f5bee0d3 (diff)
parentcaa2f31d536f568e485f15537db5e2f79f7616d5 (diff)
Merge pull request #135 from OpenVicProject/misc-changes
Miscellaneous bug fixes and format cleanup
Diffstat (limited to 'src/openvic-simulation/dataloader/Dataloader.hpp')
-rw-r--r--src/openvic-simulation/dataloader/Dataloader.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/openvic-simulation/dataloader/Dataloader.hpp b/src/openvic-simulation/dataloader/Dataloader.hpp
index de72fcd..31e0904 100644
--- a/src/openvic-simulation/dataloader/Dataloader.hpp
+++ b/src/openvic-simulation/dataloader/Dataloader.hpp
@@ -11,6 +11,11 @@ namespace OpenVic {
struct GameManager;
class UIManager;
+ template<typename _UniqueFileKey>
+ concept UniqueFileKey = requires(_UniqueFileKey const& unique_key, std::string_view path) {
+ requires std::same_as<std::remove_cvref_t<decltype(unique_key(path))>, std::string_view>;
+ };
+
class Dataloader {
public:
using path_vector_t = std::vector<fs::path>;
@@ -34,10 +39,7 @@ namespace OpenVic {
/* _DirIterator is fs::directory_iterator or fs::recursive_directory_iterator. _UniqueKey is the type of a callable
* which converts a string_view filepath with root removed into a string_view unique key. Any path whose key is empty
* or matches an earlier found path's key is discarded, ensuring each looked up path's key is non-empty and unique. */
- template<typename _DirIterator, typename _UniqueKey>
- requires requires (_UniqueKey const& unique_key, std::string_view path) {
- { unique_key(path) } -> std::convertible_to<std::string_view>;
- }
+ template<typename _DirIterator, UniqueFileKey _UniqueKey>
path_vector_t _lookup_files_in_dir(
std::string_view path, fs::path const& extension, _UniqueKey const& unique_key
) const;