/**
 *   ______ .______   .______   .______    __  .__   __.  _______
 *  /      ||   _  \  |   _  \  |   _  \  |  | |  \ |  | |       \
 * |  ,----'|  |_)  | |  |_)  | |  |_)  | |  | |   \|  | |  .--.  |
 * |  |     |   ___/  |   ___/  |   _  <  |  | |  . `  | |  |  |  |
 * |  `----.|  |      |  |      |  |_)  | |  | |  |\   | |  '--'  |
 *  \______|| _|      | _|      |______/  |__| |__| \__| |_______/
 *
 * This file is generated by cppbind on 05/12/2022-10:26.
 * Please do not change it manually.
 */

#ifndef __WRAPPER_HELPER_HPP__
#define __WRAPPER_HELPER_HPP__

#include <type_traits>
#include <memory>

namespace cppbind {

template <class Descendant, class Base>
inline auto safe_cast(void* obj_ptr) {
    if constexpr (std::is_convertible<Descendant*, Base*>::value)
        return static_cast<Descendant*>(obj_ptr);
    else
        return nullptr;
}

template <class Descendant, class Base>
inline auto safe_shared_ptr_cast(void* obj_ptr) {
    if constexpr (std::is_convertible<Descendant*, Base*>::value)
        return *static_cast<std::shared_ptr<Descendant>*>(obj_ptr);
    else
        return nullptr;
}

} // end of cppbind
#endif //__WRAPPER_HELPER_HPP__
