コード例 #1
0
bool move(To& to, From& from) {
    if (CFGetTypeID(from.c_obj()) == To::type_id()) {
        to.reset(reinterpret_cast<typename To::type>(from.release()));
        return true;
    }
    return false;
}
コード例 #2
0
To cast(From from) {
    if (CFGetTypeID(from.c_obj()) == To::type_id()) {
        return To(reinterpret_cast<typename To::type>(from.release()));
    }
    return nullptr;
}