Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:52:44

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/OpaqueIdIO.hh
0006 //---------------------------------------------------------------------------//
0007 #pragma once
0008 
0009 #include <ostream>
0010 
0011 #include "OpaqueId.hh"
0012 
0013 namespace celeritas
0014 {
0015 //---------------------------------------------------------------------------//
0016 /*!
0017  * Output an opaque ID's value or a placeholder if unavailable.
0018  */
0019 template<class V, class S>
0020 std::ostream& operator<<(std::ostream& os, OpaqueId<V, S> const& v)
0021 {
0022     if (v)
0023     {
0024         os << v.unchecked_get();
0025     }
0026     else
0027     {
0028         os << "<invalid>";
0029     }
0030     return os;
0031 }
0032 
0033 //---------------------------------------------------------------------------//
0034 }  // namespace celeritas