From 8a1cf03804b9c94bf11a99f2178821618f5a4809 Mon Sep 17 00:00:00 2001 From: Michael Uleysky Date: Sun, 30 Jul 2023 17:20:18 +1000 Subject: [PATCH] Improved ReadType-based concepts --- include/traits.h | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/include/traits.h b/include/traits.h index b0d85d7..b85dd5e 100644 --- a/include/traits.h +++ b/include/traits.h @@ -3,6 +3,7 @@ #include class BaseParameters; + using michlib::real; template @@ -82,6 +83,11 @@ template struct GetReadType_ using type = decltype(D().Read(MString(), 0)); }; +template struct GetReadType_ +{ + using type = std::decay_t; +}; + template concept HaveDisable = requires(T t) { { @@ -124,19 +130,39 @@ template using ReadType = internal::GetReadType_, template concept ReadIsGrid = requires { { - ReadType().XStep() + std::declval>().XStep() } -> std::convertible_to; { - ReadType().YStep() + std::declval>().YStep() } -> std::convertible_to; }; template concept ReadIs2DGeoRectArray = requires { { - ReadType().Ix2Lon(0) + std::declval>().Ix2Lon(0) + } -> std::convertible_to; + { + std::declval>().Iy2Lat(0) + } -> std::convertible_to; +}; + +template +concept ReadIs2DGeoArray = requires { + { + std::declval>().Lon(0, 0) + } -> std::convertible_to; + { + std::declval>().Lat(0, 0) + } -> std::convertible_to; +}; + +template +concept ReadIs1DGeoArray = requires { + { + std::declval>().Lon(0) } -> std::convertible_to; { - ReadType().Iy2Lat(0) + std::declval>().Lat(0) } -> std::convertible_to; };