@@ -63,9 +63,9 @@ class multi_store {
6363 // / @{
6464 using value_types = type_registry<ID, detail::get_value_t <Ts>...>;
6565 template <ID id>
66- using get_type = typename value_types::template get_type<id>::type ;
66+ using get_type = typename value_types::template get_type<id>;
6767 template <typename T>
68- using get_id = typename value_types::template get_index <T>;
68+ static constexpr ids get_id{ value_types::template get_id <T>()} ;
6969 // / @}
7070
7171 // / Underlying tuple container that can handle vecmem views
@@ -131,43 +131,49 @@ class multi_store {
131131 // / @returns the collections iterator at the start position.
132132 template <ID id = ID{0 }>
133133 DETRAY_HOST_DEVICE constexpr auto begin (const context_type & /* ctx*/ = {}) {
134- return detail::get<value_types::to_index (id)>(m_tuple_container)
134+ return detail::get<value_types::template to_index<id>()>(
135+ m_tuple_container)
135136 .begin ();
136137 }
137138
138139 // / @returns the collections iterator sentinel.
139140 template <ID id = ID{0 }>
140141 DETRAY_HOST_DEVICE constexpr auto end (const context_type & /* ctx*/ = {}) {
141- return detail::get<value_types::to_index (id)>(m_tuple_container).end ();
142+ return detail::get<value_types::template to_index<id>()>(
143+ m_tuple_container)
144+ .end ();
142145 }
143146
144147 // / @returns a data collection by @tparam ID - const
145148 template <ID id>
146149 DETRAY_HOST_DEVICE constexpr decltype (auto ) get(
147150 const context_type & /* ctx*/ = {}) const noexcept {
148- return detail::get<value_types::to_index (id)>(m_tuple_container);
151+ return detail::get<value_types::template to_index<id>()>(
152+ m_tuple_container);
149153 }
150154
151155 // / @returns a data collection by @tparam ID - non-const
152156 template <ID id>
153157 DETRAY_HOST_DEVICE constexpr decltype (auto ) get(
154158 const context_type & /* ctx*/ = {}) noexcept {
155- return detail::get<value_types::to_index (id)>(m_tuple_container);
159+ return detail::get<value_types::template to_index<id>()>(
160+ m_tuple_container);
156161 }
157162
158163 // / @returns the size of a data collection by @tparam ID
159164 template <ID id>
160165 DETRAY_HOST_DEVICE constexpr auto size (
161166 const context_type & /* ctx*/ = {}) const noexcept -> dindex {
162167 return static_cast <dindex>(
163- detail::get<value_types::to_index (id)>(m_tuple_container).size ());
168+ detail::get<value_types::template to_index<id>()>(m_tuple_container)
169+ .size ());
164170 }
165171
166172 // / @returns the number of elements in all collections
167173 template <std::size_t current_idx = 0 >
168174 DETRAY_HOST_DEVICE auto total_size (const context_type &ctx = {},
169175 dindex n = 0u ) const noexcept -> dindex {
170- n += size<value_types::to_id ( current_idx)>(ctx);
176+ n += size<value_types::template to_id< current_idx>( )>(ctx);
171177
172178 if constexpr (current_idx < sizeof ...(Ts) - 1 ) {
173179 return total_size<current_idx + 1 >(ctx, n);
@@ -179,15 +185,16 @@ class multi_store {
179185 template <ID id>
180186 DETRAY_HOST_DEVICE constexpr auto empty (
181187 const context_type & /* ctx*/ = {}) const noexcept -> bool {
182- return detail::get<value_types::to_index (id)>(m_tuple_container)
188+ return detail::get<value_types::template to_index<id>()>(
189+ m_tuple_container)
183190 .empty ();
184191 }
185192
186193 // / @returns true if every collection in container is empty.
187194 template <std::size_t current_idx = 0 >
188195 DETRAY_HOST_DEVICE constexpr bool all_empty (const context_type &ctx = {},
189196 bool is_empty = true ) const {
190- is_empty &= empty<value_types::to_id ( current_idx)>(ctx);
197+ is_empty &= empty<value_types::template to_id< current_idx>( )>(ctx);
191198
192199 if constexpr (current_idx < sizeof ...(Ts) - 1 ) {
193200 return all_empty<current_idx + 1 >(ctx, is_empty);
@@ -198,13 +205,14 @@ class multi_store {
198205 // / Removes and destructs all elements in a specific collection.
199206 template <ID id>
200207 DETRAY_HOST void clear (const context_type & /* ctx*/ ) {
201- detail::get<value_types::to_index (id)>(m_tuple_container).clear ();
208+ detail::get<value_types::template to_index<id>()>(m_tuple_container)
209+ .clear ();
202210 }
203211
204212 // / Removes and destructs all elements in the container.
205213 template <std::size_t current_idx = 0 >
206214 DETRAY_HOST void clear_all (const context_type &ctx = {}) {
207- clear<value_types::to_id ( current_idx)>(ctx);
215+ clear<value_types::template to_id< current_idx>( )>(ctx);
208216
209217 if constexpr (current_idx < sizeof ...(Ts) - 1 ) {
210218 clear_all<current_idx + 1 >(ctx);
@@ -214,14 +222,16 @@ class multi_store {
214222 // / Reserve memory of size @param n for a collection given by @tparam id
215223 template <ID id>
216224 DETRAY_HOST void reserve (std::size_t n, const context_type & /* ctx*/ ) {
217- detail::get<value_types::to_index (id)>(m_tuple_container).reserve (n);
225+ detail::get<value_types::template to_index<id>()>(m_tuple_container)
226+ .reserve (n);
218227 }
219228
220229 // / Resize the underlying container to @param n for a collection given by
221230 // / @tparam id
222231 template <ID id>
223232 DETRAY_HOST void resize (std::size_t n, const context_type & /* ctx*/ ) {
224- detail::get<value_types::to_index (id)>(m_tuple_container).resize (n);
233+ detail::get<value_types::template to_index<id>()>(m_tuple_container)
234+ .resize (n);
225235 }
226236
227237 // / Add a new element to a collection
@@ -236,7 +246,8 @@ class multi_store {
236246 DETRAY_HOST constexpr auto push_back (
237247 const T &arg,
238248 const context_type & /* ctx*/ = {}) noexcept (false ) -> void {
239- auto &coll = detail::get<value_types::to_index (id)>(m_tuple_container);
249+ auto &coll = detail::get<value_types::template to_index<id>()>(
250+ m_tuple_container);
240251 return coll.push_back (arg);
241252 }
242253
@@ -251,7 +262,8 @@ class multi_store {
251262 template <ID id, typename ... Args>
252263 DETRAY_HOST constexpr decltype (auto ) emplace_back(
253264 const context_type & /* ctx*/ = {}, Args &&...args) noexcept (false ) {
254- auto &coll = detail::get<value_types::to_index (id)>(m_tuple_container);
265+ auto &coll = detail::get<value_types::template to_index<id>()>(
266+ m_tuple_container);
255267 return coll.emplace_back (std::forward<Args>(args)...);
256268 }
257269
@@ -291,7 +303,8 @@ class multi_store {
291303 template <std::size_t current_idx = 0 >
292304 DETRAY_HOST void append (const multi_store &other,
293305 const context_type &ctx = {}) noexcept (false ) {
294- auto &coll = other.template get <value_types::to_id (current_idx)>();
306+ auto &coll =
307+ other.template get <value_types::template to_id<current_idx>>();
295308 insert (coll, ctx);
296309
297310 if constexpr (current_idx < sizeof ...(Ts) - 1 ) {
@@ -309,7 +322,8 @@ class multi_store {
309322 template <std::size_t current_idx = 0 >
310323 DETRAY_HOST void append (multi_store &&other,
311324 const context_type &ctx = {}) noexcept (false ) {
312- auto &coll = other.template get <value_types::to_id (current_idx)>();
325+ auto &coll =
326+ other.template get <value_types::template to_id<current_idx>()>();
313327 insert (std::move (coll), ctx);
314328
315329 if constexpr (current_idx < sizeof ...(Ts) - 1 ) {
0 commit comments