Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:09:37

0001 //------------------------------- -*- C++ -*- -------------------------------//
0002 // Copyright Celeritas contributors: see top-level COPYRIGHT file for details
0003 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0004 //---------------------------------------------------------------------------//
0005 //! \file corecel/data/detail/RefImpl.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include "corecel/Types.hh"
0010 
0011 namespace celeritas
0012 {
0013 namespace detail
0014 {
0015 //---------------------------------------------------------------------------//
0016 //! Store a value/reference and dispatch function name based on MemSpace.
0017 
0018 template<class T, MemSpace M>
0019 struct RefGetter
0020 {
0021     T obj_;
0022 
0023     auto operator()() const -> decltype(auto) { return obj_.host_ref(); }
0024 };
0025 
0026 template<class T>
0027 struct RefGetter<T, MemSpace::device>
0028 {
0029     T obj_;
0030 
0031     auto operator()() const -> decltype(auto) { return obj_.device_ref(); }
0032 };
0033 
0034 //---------------------------------------------------------------------------//
0035 }  // namespace detail
0036 }  // namespace celeritas