From 9371a3208eeb59c2728193305580f8a63776f3c6 Mon Sep 17 00:00:00 2001 From: Eugen Betke Date: Wed, 1 Mar 2023 13:27:41 +0000 Subject: [PATCH] ECC-1467: typename check in templates --- src/grib_accessor_class_data_ccsds_packing.h | 3 +++ src/grib_accessor_class_data_complex_packing.h | 1 + src/grib_accessor_class_data_g22order_packing.h | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/grib_accessor_class_data_ccsds_packing.h b/src/grib_accessor_class_data_ccsds_packing.h index 75b13ac29..4edc152d3 100644 --- a/src/grib_accessor_class_data_ccsds_packing.h +++ b/src/grib_accessor_class_data_ccsds_packing.h @@ -1,5 +1,7 @@ #pragma once + #include "grib_api_internal_cpp.h" +#include #if defined(HAVE_LIBAEC) || defined(HAVE_AEC) #include @@ -42,6 +44,7 @@ public: template int GribAccessorDataCcsdsPacking::unpack(grib_accessor* a, T* val, size_t* len) { + static_assert(std::is_floating_point::value, "Requires floating point numbers"); grib_accessor_data_ccsds_packing* self = (grib_accessor_data_ccsds_packing*)a; grib_handle* hand = grib_handle_of_accessor(a); diff --git a/src/grib_accessor_class_data_complex_packing.h b/src/grib_accessor_class_data_complex_packing.h index be7b7287f..c490f8218 100644 --- a/src/grib_accessor_class_data_complex_packing.h +++ b/src/grib_accessor_class_data_complex_packing.h @@ -51,6 +51,7 @@ public: template int GribAccessorClassDataComplexPacking::unpack(grib_accessor* a, T* val, size_t* len) { + static_assert(std::is_floating_point::value, "Requires floating point numbers"); grib_accessor_data_complex_packing* self = (grib_accessor_data_complex_packing*)a; grib_handle* gh = grib_handle_of_accessor(a); diff --git a/src/grib_accessor_class_data_g22order_packing.h b/src/grib_accessor_class_data_g22order_packing.h index 70a6f612b..70ac1a63a 100644 --- a/src/grib_accessor_class_data_g22order_packing.h +++ b/src/grib_accessor_class_data_g22order_packing.h @@ -1,6 +1,7 @@ #pragma once #include "grib_api_internal.h" +#include typedef struct grib_accessor_data_g22order_packing { @@ -45,6 +46,7 @@ public: template int GribAccessorDataG22orderPacking::unpack(grib_accessor* a, T* val, size_t* len) { + static_assert(std::is_floating_point::value, "Requires floating points numbers"); grib_accessor_data_g22order_packing* self = (grib_accessor_data_g22order_packing*)a; size_t i = 0;