Skip to content

Commit 8ffbc9f

Browse files
authored
Merge pull request #48103 from fwyzard/constexpr_SoA_element
Mark SoA element constructor `constexpr`
2 parents 1b55f31 + 6a13f79 commit 8ffbc9f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

DataFormats/SoATemplate/interface/SoAView.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -759,16 +759,18 @@ namespace cms::soa {
759759
\
760760
/* AoS-like accessor (mutable) */ \
761761
struct element { \
762-
SOA_HOST_DEVICE SOA_INLINE \
762+
SOA_HOST_DEVICE SOA_INLINE constexpr \
763763
element(size_type _soa_impl_index, /* Declare parameters */ \
764764
_ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_ELEMENT_VALUE_ARG, BOOST_PP_EMPTY(), VALUE_LIST)) \
765765
: _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_ELEM_MEMBER_INIT, _soa_impl_index, VALUE_LIST) {} \
766-
SOA_HOST_DEVICE SOA_INLINE \
766+
\
767+
SOA_HOST_DEVICE SOA_INLINE constexpr \
767768
element& operator=(const element& _soa_impl_other) { \
768769
_ITERATE_ON_ALL(_DECLARE_VIEW_ELEMENT_VALUE_COPY, ~, VALUE_LIST) \
769770
return *this; \
770771
} \
771-
SOA_HOST_DEVICE SOA_INLINE \
772+
\
773+
SOA_HOST_DEVICE SOA_INLINE constexpr \
772774
element& operator=(const const_element& _soa_impl_other) { \
773775
_ITERATE_ON_ALL(_DECLARE_VIEW_ELEMENT_VALUE_COPY, ~, VALUE_LIST) \
774776
return *this; \
@@ -780,7 +782,7 @@ namespace cms::soa {
780782
_ITERATE_ON_ALL(_DECLARE_VIEW_ELEMENT_VALUE_MEMBER, ~, VALUE_LIST) \
781783
}; \
782784
\
783-
SOA_HOST_DEVICE SOA_INLINE \
785+
SOA_HOST_DEVICE SOA_INLINE constexpr \
784786
element operator[](size_type _soa_impl_index) { \
785787
if constexpr (rangeChecking == cms::soa::RangeChecking::enabled) { \
786788
if (_soa_impl_index >= base_type::elements_ or _soa_impl_index < 0) \
@@ -953,7 +955,7 @@ namespace cms::soa {
953955
\
954956
/* AoS-like accessor (const) */ \
955957
struct const_element { \
956-
SOA_HOST_DEVICE SOA_INLINE \
958+
SOA_HOST_DEVICE SOA_INLINE constexpr \
957959
const_element(size_type _soa_impl_index, /* Declare parameters */ \
958960
_ITERATE_ON_ALL_COMMA(_DECLARE_CONST_VIEW_ELEMENT_VALUE_ARG, const, VALUE_LIST)) \
959961
: _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_CONST_ELEM_MEMBER_INIT, _soa_impl_index, VALUE_LIST) {} \
@@ -965,7 +967,7 @@ namespace cms::soa {
965967
_ITERATE_ON_ALL(_DECLARE_VIEW_CONST_ELEMENT_VALUE_MEMBER, ~, VALUE_LIST) \
966968
}; \
967969
\
968-
SOA_HOST_DEVICE SOA_INLINE \
970+
SOA_HOST_DEVICE SOA_INLINE constexpr \
969971
const_element operator[](size_type _soa_impl_index) const { \
970972
if constexpr (rangeChecking == cms::soa::RangeChecking::enabled) { \
971973
if (_soa_impl_index >= elements_ or _soa_impl_index < 0) \

0 commit comments

Comments
 (0)