@@ -294,7 +294,8 @@ template <typename T>
294294inline constexpr Datatype determineDatatype (T &&val)
295295{
296296 (void )val; // don't need this, it only has a name for Doxygen
297- using T_stripped = std::remove_cv_t <std::remove_reference_t <T>>;
297+ using T_stripped =
298+ std::remove_extent_t <std::remove_cv_t <std::remove_reference_t <T>>>;
298299 if constexpr (auxiliary::IsPointer_v<T_stripped>)
299300 {
300301 return determineDatatype<auxiliary::IsPointer_t<T_stripped>>();
@@ -419,6 +420,8 @@ inline size_t toBits(Datatype d)
419420 return toBytes (d) * CHAR_BIT;
420421}
421422
423+ constexpr bool isSigned (Datatype d);
424+
422425/* * Compare if a Datatype is a vector type
423426 *
424427 * @param d Datatype to test
@@ -595,14 +598,19 @@ inline std::tuple<bool, bool> isInteger()
595598 */
596599template <typename T_FP>
597600inline bool isSameFloatingPoint (Datatype d)
601+ {
602+ return isSameFloatingPoint (d, determineDatatype<T_FP>());
603+ }
604+
605+ inline bool isSameFloatingPoint (Datatype d1, Datatype d2)
598606{
599607 // template
600- bool tt_is_fp = isFloatingPoint<T_FP>( );
608+ bool tt_is_fp = isFloatingPoint (d1 );
601609
602610 // Datatype
603- bool dt_is_fp = isFloatingPoint (d );
611+ bool dt_is_fp = isFloatingPoint (d2 );
604612
605- if (tt_is_fp && dt_is_fp && toBits (d ) == toBits (determineDatatype<T_FP>() ))
613+ if (tt_is_fp && dt_is_fp && toBits (d1 ) == toBits (d2 ))
606614 return true ;
607615 else
608616 return false ;
@@ -617,15 +625,19 @@ inline bool isSameFloatingPoint(Datatype d)
617625 */
618626template <typename T_CFP>
619627inline bool isSameComplexFloatingPoint (Datatype d)
628+ {
629+ return isSameComplexFloatingPoint (d, determineDatatype<T_CFP>());
630+ }
631+
632+ inline bool isSameComplexFloatingPoint (Datatype d1, Datatype d2)
620633{
621634 // template
622- bool tt_is_cfp = isComplexFloatingPoint<T_CFP>( );
635+ bool tt_is_cfp = isComplexFloatingPoint (d1 );
623636
624637 // Datatype
625- bool dt_is_cfp = isComplexFloatingPoint (d );
638+ bool dt_is_cfp = isComplexFloatingPoint (d2 );
626639
627- if (tt_is_cfp && dt_is_cfp &&
628- toBits (d) == toBits (determineDatatype<T_CFP>()))
640+ if (tt_is_cfp && dt_is_cfp && toBits (d1) == toBits (d2))
629641 return true ;
630642 else
631643 return false ;
@@ -640,17 +652,22 @@ inline bool isSameComplexFloatingPoint(Datatype d)
640652 */
641653template <typename T_Int>
642654inline bool isSameInteger (Datatype d)
655+ {
656+ return isSameInteger (d, determineDatatype<T_Int>());
657+ }
658+
659+ inline bool isSameInteger (Datatype d1, Datatype d2)
643660{
644661 // template
645662 bool tt_is_int, tt_is_sig;
646- std::tie (tt_is_int, tt_is_sig) = isInteger<T_Int>( );
663+ std::tie (tt_is_int, tt_is_sig) = isInteger (d1 );
647664
648665 // Datatype
649666 bool dt_is_int, dt_is_sig;
650- std::tie (dt_is_int, dt_is_sig) = isInteger (d );
667+ std::tie (dt_is_int, dt_is_sig) = isInteger (d2 );
651668
652669 if (tt_is_int && dt_is_int && tt_is_sig == dt_is_sig &&
653- toBits (d ) == toBits (determineDatatype<T_Int>() ))
670+ toBits (d1 ) == toBits (d2 ))
654671 return true ;
655672 else
656673 return false ;
@@ -691,46 +708,15 @@ constexpr bool isChar(Datatype d)
691708template <typename T_Char>
692709constexpr bool isSameChar (Datatype d);
693710
711+ constexpr bool isSameChar (Datatype d1, Datatype d2);
712+
694713/* * Comparison for two Datatypes
695714 *
696715 * Besides returning true for the same types, identical implementations on
697716 * some platforms, e.g. if long and long long are the same or double and
698717 * long double will also return true.
699718 */
700- inline bool isSame (openPMD::Datatype const d, openPMD::Datatype const e)
701- {
702- // exact same type
703- if (static_cast <int >(d) == static_cast <int >(e))
704- return true ;
705-
706- bool d_is_vec = isVector (d);
707- bool e_is_vec = isVector (e);
708-
709- // same int
710- bool d_is_int, d_is_sig;
711- std::tie (d_is_int, d_is_sig) = isInteger (d);
712- bool e_is_int, e_is_sig;
713- std::tie (e_is_int, e_is_sig) = isInteger (e);
714- if (d_is_int && e_is_int && d_is_vec == e_is_vec && d_is_sig == e_is_sig &&
715- toBits (d) == toBits (e))
716- return true ;
717-
718- // same float
719- bool d_is_fp = isFloatingPoint (d);
720- bool e_is_fp = isFloatingPoint (e);
721-
722- if (d_is_fp && e_is_fp && d_is_vec == e_is_vec && toBits (d) == toBits (e))
723- return true ;
724-
725- // same complex floating point
726- bool d_is_cfp = isComplexFloatingPoint (d);
727- bool e_is_cfp = isComplexFloatingPoint (e);
728-
729- if (d_is_cfp && e_is_cfp && d_is_vec == e_is_vec && toBits (d) == toBits (e))
730- return true ;
731-
732- return false ;
733- }
719+ constexpr bool isSame (openPMD::Datatype d, openPMD::Datatype e);
734720
735721/* *
736722 * @brief basicDatatype Strip openPMD Datatype of std::vector, std::array et.
0 commit comments