Server IP : 104.21.38.3 / Your IP : 162.158.170.251 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/boost/boost_1_59_0/boost/python/ |
Upload File : |
// Copyright David Abrahams 2002. // Distributed under 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) #ifndef CAST_DWA200269_HPP # define CAST_DWA200269_HPP # include <boost/python/detail/prefix.hpp> # include <boost/type_traits/same_traits.hpp> # include <boost/type_traits/cv_traits.hpp> # include <boost/type.hpp> # include <boost/python/base_type_traits.hpp> # include <boost/python/detail/convertible.hpp> namespace boost { namespace python { namespace detail { template <class Source, class Target> inline Target* upcast_impl(Source*, Target*); template <class Source, class Target> inline Target* upcast(Source* p, yes_convertible, no_convertible, Target*) { return p; } template <class Source, class Target> inline Target* upcast(Source* p, no_convertible, no_convertible, Target*) { typedef typename base_type_traits<Source>::type base; return detail::upcast_impl((base*)p, (Target*)0); } template <bool is_same = true> struct upcaster { template <class T> static inline T* execute(T* x, T*) { return x; } }; template <> struct upcaster<false> { template <class Source, class Target> static inline Target* execute(Source* x, Target*) { return detail::upcast( x, detail::convertible<Target*>::check(x) , detail::convertible<Source*>::check((Target*)0) , (Target*)0); } }; template <class Target, class Source> inline Target* downcast(Source* p, yes_convertible) { return static_cast<Target*>(p); } template <class Target, class Source> inline Target* downcast(Source* p, no_convertible, boost::type<Target>* = 0) { typedef typename base_type_traits<Source>::type base; return (Target*)detail::downcast<base>(p, convertible<Source*>::check((base*)0)); } template <class T> inline void assert_castable(boost::type<T>* = 0) { typedef char must_be_a_complete_type[sizeof(T)]; } template <class Source, class Target> inline Target* upcast_impl(Source* x, Target*) { typedef typename add_cv<Source>::type src_t; typedef typename add_cv<Target>::type target_t; bool const same = is_same<src_t,target_t>::value; return detail::upcaster<same>::execute(x, (Target*)0); } } template <class Target, class Source> inline Target* upcast(Source* x, Target* = 0) { detail::assert_castable<Source>(); detail::assert_castable<Target>(); return detail::upcast_impl(x, (Target*)0); } template <class Target, class Source> inline Target* downcast(Source* x, Target* = 0) { detail::assert_castable<Source>(); detail::assert_castable<Target>(); return detail::downcast<Target>(x, detail::convertible<Source*>::check((Target*)0)); } }} // namespace boost::python #endif // CAST_DWA200269_HPP