// Semantics Consulting's Tyr Library // http://www.semantics.org // // Copyright (c) 2003 by Stephen C. Dewhurst // // Permission to use, copy, modify, distribute, and sell this software // for any purpose is hereby granted without fee, provided that the above // copyright notice appears in all copies and that both that copyright // notice and this permission notice appear in supporting documentation. // The author makes no representations about the suitability of this // software for any purpose. It is provided "as is" without express // or implied warranty. // Described in: // Unfinished Business. C/C++ Users Journal Experts Forum, 21, 11 (November 2003). #ifndef MULTICAST_H #define MULTICAST_H #include "metafunction.h" #include "typelistalgorithms.h" #include "dismantle.h" namespace Tyr { template struct ConversionReturnType { typedef typename EraseIf::template Adapted>::template Adapted>::R Candidates; typedef typename Append::R CandidatesV; typedef typename CandidatesV::head R; }; template typename ConversionReturnType::R multiconvert( const E &expr ) { typedef typename ConversionReturnType::R Ret; return static_cast(expr); // cast to avoid warnings } // can_const_cast just strips off all the type qualifiers // and sees if the types are the same template struct IsQualDis { enum { r = IsSame::r || IsSame::r }; }; template struct RemoveQualsDis { typedef typename Dis::R Dissed; typedef typename EraseIf::R NoQual; typedef typename Regen::R R; }; /* template struct CanConstCast { typedef typename RemoveQualsDis::R RT1; typedef typename RemoveQualsDis::R RT2; enum { r = IsSame::r }; }; template struct ConstCastReturnType { typedef typename EraseIf::template Adapted>::template Adapted>::R Candidates; typedef typename Append::R CandidatesV; typedef typename CandidatesV::head R; }; template typename ConstCastReturnType::R multiconst_cast( const E &expr ) { typedef typename ConstCastReturnType::R Ret; return const_cast(expr); } */ } // namespace Tyr #endif