/
usr
/
include
/
boost
/
serialization
/
/usr/include/boost/serialization
mkdir
upload
Name
Size
Mode
Actions
detail/
-
0755
rm
access.hpp
4374
0644
edit
dl
rm
archive_input_unordered_map.hpp
2794
0644
edit
dl
rm
archive_input_unordered_set.hpp
2275
0644
edit
dl
rm
array.hpp
1443
0644
edit
dl
rm
array_optimization.hpp
1381
0644
edit
dl
rm
array_wrapper.hpp
3271
0644
edit
dl
rm
assume_abstract.hpp
1935
0644
edit
dl
rm
base_object.hpp
3008
0644
edit
dl
rm
binary_object.hpp
2295
0644
edit
dl
rm
bitset.hpp
1953
0644
edit
dl
rm
boost_array.hpp
949
0644
edit
dl
rm
boost_unordered_map.hpp
4272
0644
edit
dl
rm
boost_unordered_set.hpp
4044
0644
edit
dl
rm
collections_load_imp.hpp
2917
0644
edit
dl
rm
collections_save_imp.hpp
2306
0644
edit
dl
rm
collection_size_type.hpp
1764
0644
edit
dl
rm
collection_size_type copy.hpp
3415
0644
edit
dl
rm
collection_traits.hpp
3679
0644
edit
dl
rm
complex.hpp
2219
0644
edit
dl
rm
config.hpp
2734
0644
edit
dl
rm
deque.hpp
2324
0644
edit
dl
rm
export.hpp
8215
0644
edit
dl
rm
extended_type_info.hpp
3604
0644
edit
dl
rm
extended_type_info_no_rtti.hpp
6367
0644
edit
dl
rm
extended_type_info_typeid.hpp
5661
0644
edit
dl
rm
factory.hpp
4099
0644
edit
dl
rm
force_include.hpp
2073
0644
edit
dl
rm
forward_list.hpp
3865
0644
edit
dl
rm
hash_collections_load_imp.hpp
2686
0644
edit
dl
rm
hash_collections_save_imp.hpp
3435
0644
edit
dl
rm
hash_map.hpp
6313
0644
edit
dl
rm
hash_set.hpp
5884
0644
edit
dl
rm
is_bitwise_serializable.hpp
1399
0644
edit
dl
rm
item_version_type.hpp
1856
0644
edit
dl
rm
level.hpp
3621
0644
edit
dl
rm
level_enum.hpp
2140
0644
edit
dl
rm
library_version_type.hpp
2045
0644
edit
dl
rm
list.hpp
2485
0644
edit
dl
rm
map.hpp
4447
0644
edit
dl
rm
nvp.hpp
3538
0644
edit
dl
rm
optional.hpp
3201
0644
edit
dl
rm
priority_queue.hpp
2413
0644
edit
dl
rm
queue.hpp
2094
0644
edit
dl
rm
scoped_ptr.hpp
1552
0644
edit
dl
rm
serialization.hpp
4678
0644
edit
dl
rm
set.hpp
4284
0644
edit
dl
rm
shared_ptr.hpp
9821
0644
edit
dl
rm
shared_ptr_132.hpp
7370
0644
edit
dl
rm
shared_ptr_helper.hpp
7047
0644
edit
dl
rm
singleton.hpp
7603
0644
edit
dl
rm
slist.hpp
4828
0644
edit
dl
rm
smart_cast.hpp
8944
0644
edit
dl
rm
split_free.hpp
2734
0644
edit
dl
rm
split_member.hpp
2640
0644
edit
dl
rm
stack.hpp
2093
0644
edit
dl
rm
state_saver.hpp
2691
0644
edit
dl
rm
static_warning.hpp
3844
0644
edit
dl
rm
string.hpp
976
0644
edit
dl
rm
strong_typedef.hpp
3084
0644
edit
dl
rm
throw_exception.hpp
947
0644
edit
dl
rm
tracking.hpp
3990
0644
edit
dl
rm
tracking_enum.hpp
1227
0644
edit
dl
rm
traits.hpp
2017
0644
edit
dl
rm
type_info_implementation.hpp
2621
0644
edit
dl
rm
unique_ptr.hpp
1971
0644
edit
dl
rm
unordered_collections_load_imp.hpp
2438
0644
edit
dl
rm
unordered_collections_save_imp.hpp
2993
0644
edit
dl
rm
unordered_map.hpp
4164
0644
edit
dl
rm
unordered_set.hpp
4024
0644
edit
dl
rm
utility.hpp
1789
0644
edit
dl
rm
valarray.hpp
2754
0644
edit
dl
rm
variant.hpp
5122
0644
edit
dl
rm
vector.hpp
6924
0644
edit
dl
rm
vector_135.hpp
942
0644
edit
dl
rm
version.hpp
4291
0644
edit
dl
rm
void_cast.hpp
8747
0644
edit
dl
rm
void_cast_fwd.hpp
1187
0644
edit
dl
rm
weak_ptr.hpp
2437
0644
edit
dl
rm
wrapper.hpp
1907
0644
edit
dl
rm
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 <exception> #include <typeinfo> #include <cstddef> // NULL #include <boost/config.hpp> #include <boost/static_assert.hpp> #include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/is_polymorphic.hpp> #include <boost/type_traits/is_pointer.hpp> #include <boost/type_traits/is_reference.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/remove_pointer.hpp> #include <boost/type_traits/remove_reference.hpp> #include <boost/mpl/eval_if.hpp> #include <boost/mpl/if.hpp> #include <boost/mpl/or.hpp> #include <boost/mpl/and.hpp> #include <boost/mpl/not.hpp> #include <boost/mpl/identity.hpp> #include <boost/serialization/throw_exception.hpp> namespace boost { namespace serialization { namespace smart_cast_impl { template<class T> struct reference { struct polymorphic { struct linear { template<class U> static T cast(U & u){ return static_cast< T >(u); } }; struct cross { template<class U> static T cast(U & u){ return dynamic_cast< T >(u); } }; template<class U> 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_<is_base_and_derived< typename remove_reference< T >::type, U > >, mpl::not_<is_base_and_derived< U, typename remove_reference< T >::type > > >, // borland chokes w/o full qualification here mpl::identity<cross>, mpl::identity<linear> >::type typex; // typex works around gcc 2.95 issue return typex::cast(u); #endif } }; struct non_polymorphic { template<class U> static T cast(U & u){ return static_cast< T >(u); } }; template<class U> static T cast(U & u){ typedef typename mpl::eval_if< boost::is_polymorphic<U>, mpl::identity<polymorphic>, mpl::identity<non_polymorphic> >::type typex; return typex::cast(u); } }; template<class T> 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<class U> static T cast(U * u){ return static_cast< T >(u); } }; struct cross { template<class U> 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<class U> static T cast(U * u){ typedef typename mpl::eval_if< typename mpl::and_< mpl::not_<is_base_and_derived< typename remove_pointer< T >::type, U > >, mpl::not_<is_base_and_derived< U, typename remove_pointer< T >::type > > >, // borland chokes w/o full qualification here mpl::identity<cross>, mpl::identity<linear> >::type typex; return typex::cast(u); } #else template<class U> 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<class U> static T cast(U * u){ return static_cast< T >(u); } }; template<class U> static T cast(U * u){ typedef typename mpl::eval_if< boost::is_polymorphic<U>, mpl::identity<polymorphic>, mpl::identity<non_polymorphic> >::type typex; return typex::cast(u); } }; template<class TPtr> struct void_pointer { template<class UPtr> static TPtr cast(UPtr uptr){ return static_cast<TPtr>(uptr); } }; template<class T> 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<class U> static T cast(U){ BOOST_STATIC_ASSERT(sizeof(T)==0); return * static_cast<T *>(NULL); } }; } // smart_cast_impl // this implements: // smart_cast<Target *, Source *>(Source * s) // smart_cast<Target &, Source &>(s) // note that it will fail with // smart_cast<Target &>(s) template<class T, class U> T smart_cast(U u) { typedef typename mpl::eval_if< typename mpl::or_< boost::is_same<void *, U>, boost::is_same<void *, T>, boost::is_same<const void *, U>, boost::is_same<const void *, T> >, mpl::identity<smart_cast_impl::void_pointer< T > >, // else typename mpl::eval_if<boost::is_pointer<U>, mpl::identity<smart_cast_impl::pointer< T > >, // else typename mpl::eval_if<boost::is_reference<U>, mpl::identity<smart_cast_impl::reference< T > >, // else mpl::identity<smart_cast_impl::error< T > > > > >::type typex; return typex::cast(u); } // this implements: // smart_cast_reference<Target &>(Source & s) template<class T, class U> T smart_cast_reference(U & u) { return smart_cast_impl::reference< T >::cast(u); } } // namespace serialization } // namespace boost #endif // BOOST_SERIALIZATION_SMART_CAST_HPP
Save
cmd:
run