bool operator==(const std::shared_ptr<glm::vec3> &v0, const glm::vec3 &v1) {
return *v0 == v1;
}
bool operator==(const glm::vec3 &v0, const std::shared_ptr<glm::vec3> &v1) {
return v0 == *v1;
}
TEST (smartPointersAndOperators, OperatorEquals2) {
std::vector<std::shared_ptr<glm::vec3>> allAs {
std::make_shared<glm::vec3>(),
std::make_shared<glm::vec3>(),
std::make_shared<glm::vec3>()};
glm::vec3 obj;
auto it = std::find(allAs.cbegin(), allAs.cend(), obj);
}
In file included from /home/dejo/Projekte/OpenGL/SansiEngine/test/C++11/c++11_Features_main.cpp:8:
In file included from /usr/include/gtest/gtest.h:55:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ostream:38:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ios:40:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/char_traits.h:39:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:71:
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/predefined_ops.h:194:17: error: invalid operands to binary expression ('const std::shared_ptr<glm::tvec3<float,
glm::precision::packed_highp> >' and 'const glm::tvec3<float, glm::precision::packed_highp>')
{ return *__it == _M_value; }
~~~~~ ^ ~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_algo.h:120:8: note: in instantiation of function template specialization
'__gnu_cxx::__ops::_Iter_equals_val<const glm::tvec3<float, glm::precision::packed_highp> >::operator()<__gnu_cxx::__normal_iterator<const std::shared_ptr<glm::tvec3<float,
glm::precision::packed_highp> > *, std::vector<std::shared_ptr<glm::tvec3<float, glm::precision::packed_highp> >, std::allocator<std::shared_ptr<glm::tvec3<float,
glm::precision::packed_highp> > > > > >' requested here
if (__pred(__first))
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_algo.h:161:14: note: in instantiation of function template specialization
'std::__find_if<__gnu_cxx::__normal_iterator<const std::shared_ptr<glm::tvec3<float, glm::precision::packed_highp> > *, std::vector<std::shared_ptr<glm::tvec3<float,
glm::precision::packed_highp> >, std::allocator<std::shared_ptr<glm::tvec3<float, glm::precision::packed_highp> > > > >, __gnu_cxx::__ops::_Iter_equals_val<const glm::tvec3<float,
glm::precision::packed_highp> > >' requested here
return __find_if(__first, __last, __pred,
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_algo.h:3790:19: note: in instantiation of function template specialization
'std::__find_if<__gnu_cxx::__normal_iterator<const std::shared_ptr<glm::tvec3<float, glm::precision::packed_highp> > *, std::vector<std::shared_ptr<glm::tvec3<float,
glm::precision::packed_highp> >, std::allocator<std::shared_ptr<glm::tvec3<float, glm::precision::packed_highp> > > > >, __gnu_cxx::__ops::_Iter_equals_val<const glm::tvec3<float,
glm::precision::packed_highp> > >' requested here
return std::__find_if(__first, __last,
^
/home/dejo/Projekte/OpenGL/SansiEngine/test/C++11/templates/TemplateUnderTest.hpp:250:17: note: in instantiation of function template specialization
'std::find<__gnu_cxx::__normal_iterator<const std::shared_ptr<glm::tvec3<float, glm::precision::packed_highp> > *, std::vector<std::shared_ptr<glm::tvec3<float,
glm::precision::packed_highp> >, std::allocator<std::shared_ptr<glm::tvec3<float, glm::precision::packed_highp> > > > >, glm::tvec3<float, glm::precision::packed_highp> >' requested
here
auto it = std::find(allAs.cbegin(), allAs.cend(), obj);