aboutsummaryrefslogtreecommitdiff
path: root/include/openvic-dataloader/detail/Concepts.hpp
blob: 3e1c78561757e3a80dcb6ff9470ea8dba650811a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once

#include <concepts>
#include <optional>
#include <type_traits>
#include <utility>

#include <openvic-dataloader/ParseError.hpp>

namespace ovdl::detail {
   template<typename T, typename Self, typename... Args>
   concept LoadCallback =
      requires(T t, Self* self, Args... args) {
         { t(self, std::forward<Args>(args)...) } -> std::same_as<std::optional<ParseError>>;
      };

   template<typename T>
   concept Has_c_str =
      requires(T t) {
         { t.c_str() } -> std::same_as<const char*>;
      };
}