Skip to content

Function in global namespace with same names as std ones can be confusing

I see these were introduced in [d66216a2]

// Function to perform an easy pointer cast from one GeoIntrusivePtr type to another
template <class ToCast, class FromCast>
    GeoIntrusivePtr<ToCast> dynamic_pointer_cast(const GeoIntrusivePtr<FromCast>& from) {
        ToCast* raw_ptr = dynamic_cast<ToCast*>(from.get());
        return GeoIntrusivePtr<ToCast>(raw_ptr);
    }
/// Function to perform an easy pointer const_cast from one GeoIntrusivePtr type to another
template <class CastType>
    GeoIntrusivePtr<CastType> const_pointer_cast(const GeoIntrusivePtr<const CastType>& from) {
        CastType* raw_ptr = const_cast<CastType*>(from.get());
        return GeoIntrusivePtr<CastType>(raw_ptr);
    }
/// Create a GeoModel object and pipe it directly into the GeoIntrusivePtr
template <class GeoObjType, class... Args> 
    GeoIntrusivePtr<GeoObjType> make_intrusive(Args... args) {
    return GeoIntrusivePtr<GeoObjType>{new GeoObjType(args...)};
}

The std:: has similarly named ones for shared_ptr see https://en.cppreference.com/w/cpp/memory/shared_ptr/pointer_cast

I do not know what are exactly the rules for the GeoModel project but I would imagine it will be nicer to have these not in the Global namespace

aka could be added under GeoModel::