/usr/include/boost/serialization
NameSizeModeActions
detail/-0755rm
access.hpp43740644editdlrm
archive_input_unordered_map.hpp27940644editdlrm
archive_input_unordered_set.hpp22750644editdlrm
array.hpp14430644editdlrm
array_optimization.hpp13810644editdlrm
array_wrapper.hpp32710644editdlrm
assume_abstract.hpp19350644editdlrm
base_object.hpp30080644editdlrm
binary_object.hpp22950644editdlrm
bitset.hpp19530644editdlrm
boost_array.hpp9490644editdlrm
boost_unordered_map.hpp42720644editdlrm
boost_unordered_set.hpp40440644editdlrm
collections_load_imp.hpp29170644editdlrm
collections_save_imp.hpp23060644editdlrm
collection_size_type.hpp17640644editdlrm
collection_size_type copy.hpp34150644editdlrm
collection_traits.hpp36790644editdlrm
complex.hpp22190644editdlrm
config.hpp27340644editdlrm
deque.hpp23240644editdlrm
export.hpp82150644editdlrm
extended_type_info.hpp36040644editdlrm
extended_type_info_no_rtti.hpp63670644editdlrm
extended_type_info_typeid.hpp56610644editdlrm
factory.hpp40990644editdlrm
force_include.hpp20730644editdlrm
forward_list.hpp38650644editdlrm
hash_collections_load_imp.hpp26860644editdlrm
hash_collections_save_imp.hpp34350644editdlrm
hash_map.hpp63130644editdlrm
hash_set.hpp58840644editdlrm
is_bitwise_serializable.hpp13990644editdlrm
item_version_type.hpp18560644editdlrm
level.hpp36210644editdlrm
level_enum.hpp21400644editdlrm
library_version_type.hpp20450644editdlrm
list.hpp24850644editdlrm
map.hpp44470644editdlrm
nvp.hpp35380644editdlrm
optional.hpp32010644editdlrm
priority_queue.hpp24130644editdlrm
queue.hpp20940644editdlrm
scoped_ptr.hpp15520644editdlrm
serialization.hpp46780644editdlrm
set.hpp42840644editdlrm
shared_ptr.hpp98210644editdlrm
shared_ptr_132.hpp73700644editdlrm
shared_ptr_helper.hpp70470644editdlrm
singleton.hpp76030644editdlrm
slist.hpp48280644editdlrm
smart_cast.hpp89440644editdlrm
split_free.hpp27340644editdlrm
split_member.hpp26400644editdlrm
stack.hpp20930644editdlrm
state_saver.hpp26910644editdlrm
static_warning.hpp38440644editdlrm
string.hpp9760644editdlrm
strong_typedef.hpp30840644editdlrm
throw_exception.hpp9470644editdlrm
tracking.hpp39900644editdlrm
tracking_enum.hpp12270644editdlrm
traits.hpp20170644editdlrm
type_info_implementation.hpp26210644editdlrm
unique_ptr.hpp19710644editdlrm
unordered_collections_load_imp.hpp24380644editdlrm
unordered_collections_save_imp.hpp29930644editdlrm
unordered_map.hpp41640644editdlrm
unordered_set.hpp40240644editdlrm
utility.hpp17890644editdlrm
valarray.hpp27540644editdlrm
variant.hpp51220644editdlrm
vector.hpp69240644editdlrm
vector_135.hpp9420644editdlrm
version.hpp42910644editdlrm
void_cast.hpp87470644editdlrm
void_cast_fwd.hpp11870644editdlrm
weak_ptr.hpp24370644editdlrm
wrapper.hpp19070644editdlrm
Edit: /usr/include/boost/serialization/smart_cast.hpp (8944B)
#ifndef BOOST_SERIALIZATION_SMART_CAST_HPP #define BOOST_SERIALIZATION_SMART_CAST_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) # pragma once #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // smart_cast.hpp: // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/serialization for updates, documentation, and revision history. // casting of pointers and references. // In casting between different C++ classes, there are a number of // rules that have to be kept in mind in deciding whether to use // static_cast or dynamic_cast. // a) dynamic casting can only be applied when one of the types is polymorphic // Otherwise static_cast must be used. // b) only dynamic casting can do runtime error checking // use of static_cast is generally un checked even when compiled for debug // c) static_cast would be considered faster than dynamic_cast. // If casting is applied to a template parameter, there is no apriori way // to know which of the two casting methods will be permitted or convenient. // smart_cast uses C++ type_traits, and program debug mode to select the // most convenient cast to use. #include #include #include // NULL #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace serialization { namespace smart_cast_impl { template struct reference { struct polymorphic { struct linear { template static T cast(U & u){ return static_cast< T >(u); } }; struct cross { template static T cast(U & u){ return dynamic_cast< T >(u); } }; template static T cast(U & u){ // if we're in debug mode #if ! defined(NDEBUG) \ || defined(__MWERKS__) // do a checked dynamic cast return cross::cast(u); #else // borland 5.51 chokes here so we can't use it // note: if remove_reference isn't function for these types // cross casting will be selected this will work but will // not be the most efficient method. This will conflict with // the original smart_cast motivation. typedef typename mpl::eval_if< typename mpl::and_< mpl::not_::type, U > >, mpl::not_::type > > >, // borland chokes w/o full qualification here mpl::identity, mpl::identity >::type typex; // typex works around gcc 2.95 issue return typex::cast(u); #endif } }; struct non_polymorphic { template static T cast(U & u){ return static_cast< T >(u); } }; template static T cast(U & u){ typedef typename mpl::eval_if< boost::is_polymorphic, mpl::identity, mpl::identity >::type typex; return typex::cast(u); } }; template struct pointer { struct polymorphic { // unfortunately, this below fails to work for virtual base // classes. need has_virtual_base to do this. // Subject for further study #if 0 struct linear { template static T cast(U * u){ return static_cast< T >(u); } }; struct cross { template static T cast(U * u){ T tmp = dynamic_cast< T >(u); #ifndef NDEBUG if ( tmp == 0 ) throw_exception(std::bad_cast()); #endif return tmp; } }; template static T cast(U * u){ typedef typename mpl::eval_if< typename mpl::and_< mpl::not_::type, U > >, mpl::not_::type > > >, // borland chokes w/o full qualification here mpl::identity, mpl::identity >::type typex; return typex::cast(u); } #else template static T cast(U * u){ T tmp = dynamic_cast< T >(u); #ifndef NDEBUG if ( tmp == 0 ) throw_exception(std::bad_cast()); #endif return tmp; } #endif }; struct non_polymorphic { template static T cast(U * u){ return static_cast< T >(u); } }; template static T cast(U * u){ typedef typename mpl::eval_if< boost::is_polymorphic, mpl::identity, mpl::identity >::type typex; return typex::cast(u); } }; template struct void_pointer { template static TPtr cast(UPtr uptr){ return static_cast(uptr); } }; template struct error { // if we get here, its because we are using one argument in the // cast on a system which doesn't support partial template // specialization template static T cast(U){ BOOST_STATIC_ASSERT(sizeof(T)==0); return * static_cast(NULL); } }; } // smart_cast_impl // this implements: // smart_cast(Source * s) // smart_cast(s) // note that it will fail with // smart_cast(s) template T smart_cast(U u) { typedef typename mpl::eval_if< typename mpl::or_< boost::is_same, boost::is_same, boost::is_same, boost::is_same >, mpl::identity >, // else typename mpl::eval_if, mpl::identity >, // else typename mpl::eval_if, mpl::identity >, // else mpl::identity > > > >::type typex; return typex::cast(u); } // this implements: // smart_cast_reference(Source & s) template T smart_cast_reference(U & u) { return smart_cast_impl::reference< T >::cast(u); } } // namespace serialization } // namespace boost #endif // BOOST_SERIALIZATION_SMART_CAST_HPP