Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:50

0001 //----------------------------------*-C++-*----------------------------------//
0002 // Copyright 2023-2024 UT-Battelle, LLC, and other Celeritas developers.
0003 // See the top-level COPYRIGHT file for details.
0004 // SPDX-License-Identifier: (Apache-2.0 OR MIT)
0005 //---------------------------------------------------------------------------//
0006 //! \file corecel/OpaqueIdIO.hh
0007 //---------------------------------------------------------------------------//
0008 #pragma once
0009 
0010 #include <ostream>
0011 
0012 #include "OpaqueId.hh"
0013 
0014 namespace celeritas
0015 {
0016 //---------------------------------------------------------------------------//
0017 /*!
0018  * Output an opaque ID's value or a placeholder if unavailable.
0019  */
0020 template<class V, class S>
0021 std::ostream& operator<<(std::ostream& os, OpaqueId<V, S> const& v)
0022 {
0023     if (v)
0024     {
0025         os << v.unchecked_get();
0026     }
0027     else
0028     {
0029         os << "<invalid>";
0030     }
0031     return os;
0032 }
0033 
0034 //---------------------------------------------------------------------------//
0035 }  // namespace celeritas