lundi 19 février 2018

Dynamic pointer cast compile error when I compile with C++11

I'm developping an app with OpenFrameworks with C++ language. In my program there is a line that makes a dynamic cast pointer

Ref_<ImageUniform> p = o.cast<ImageUniform>();

Here is the cast() function implementation

template <typename TT>
Ref_<TT> cast() const { return dynamic_pointer_cast<TT>(*this); }

When I compile without the -std=c++11 it works. But when I put the -std=c++11 it prints me a compile error and refers me to an internal file "ofTypes.h" of the library of OpenFrameworks at this line 191:

#else
    template<typename Tp1>
    ofPtr(const ofPtr<Tp1>& __r, std::__dynamic_cast_tag)
    : std::shared_ptr<T>(__r, std::__dynamic_cast_tag()) { }
#endif

And also here is the compile error

......\libs\openFrameworks\types\ofTypes.h|193|error: no matching function >for call to 'std::shared_ptr::shared_ptr(const >ofPtr&, std::tr1::__dynamic_cast_tag)'| #else template ofPtr(const ofPtr& __r, std::__dynamic_cast_tag) : std::shared_ptr(__r, std::__dynamic_cast_tag()) { } #endif

Aucun commentaire:

Enregistrer un commentaire