Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Bug : filtering vertices.  (Read 1483 times)

0 Members and 1 Guest are viewing this topic.

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Bug : filtering vertices.
« on: March 31, 2014, 11:42:26 am »
Hi, I've made a class to filter all vertices by material and primitive type to put them in a vbo.

I put them in a std::map but when I try to insert them into the std::map I get this error :

Code: [Select]
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h||In member function 'void odfaeg::Listener::connectAction(std::string, odfaeg::ActionMap)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h|26|warning: left operand of comma operator has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h|26|warning: right operand of comma operator has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\..\transformable.h||In member function 'const odfaeg::Matrix4f& odfaeg::Transformable::getMatrix()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\..\transformable.h|136|warning: returning reference to temporary [-Wreturn-local-addr]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\entity.h||In member function 'bool odfaeg::g2d::Entity::removeAttribute(std::string)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\entity.h|106|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'odfaeg::Texture* odfaeg::g2d::Material::getTexture(int)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|42|warning: invalid conversion from 'const odfaeg::Texture*' to 'odfaeg::Texture*' [-fpermissive]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'virtual bool odfaeg::g2d::Face::operator==(odfaeg::g2d::Entity&)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|99|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'void odfaeg::g2d::FaceGroup::Filter::operator==(odfaeg::g2d::FaceGroup::Filter&)':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|137|warning: return-statement with a value, in function returning 'void' [-fpermissive]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'void odfaeg::g2d::FaceGroup::zSorting()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|192|warning: unused variable 'zMoy2' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|186|warning: unused variable 'zMoy1' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'void odfaeg::g2d::FaceGroup::alphaSorting()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|215|warning: unused variable 'zMoy2' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|209|warning: unused variable 'aMoy1' [-Wunused-variable]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h||In member function 'std::vector<odfaeg::g2d::Face*>& odfaeg::g2d::FaceGroup::getFaces()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|226|warning: statement has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|227|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Core\entitySystem.h|15|warning: ISO C++ forbids declaration of 'launch' with no type [-fpermissive]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Core\entitySystem.h||In member function 'int odfaeg::EntitySystem::launch()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Core\entitySystem.h|20|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h||In member function 'odfaeg::Listener& odfaeg::Application::getListener()':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h|109|warning: value computed is not used [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h|109|warning: statement has no effect [-Wunused-value]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\application.h|110|warning: no return statement in function returning non-void [-Wreturn-type]|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\signal.h||In instantiation of 'R odfaeg::FastDelegate<R>::operator()() [with R = bool]':|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\system.h|123|required from here|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\signal.h|223|warning: cast from 'void*' to 'bool' loses precision [-fpermissive]|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h||In instantiation of 'bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = odfaeg::g2d::FaceGroup::Filter]':|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_tree.h|1791|required from 'std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::find(const _Key&) [with _Key = odfaeg::g2d::FaceGroup::Filter; _Val = std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*>; _KeyOfValue = std::_Select1st<std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*> >; _Compare = std::less<odfaeg::g2d::FaceGroup::Filter>; _Alloc = std::allocator<std::pair<const odfaeg::g2d::FaceGroup::Fil|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_map.h|821|required from 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const key_type&) [with _Key = odfaeg::g2d::FaceGroup::Filter; _Tp = odfaeg::g2d::FaceGroup*; _Compare = std::less<odfaeg::g2d::FaceGroup::Filter>; _Alloc = std::allocator<std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const odfaeg::g2d::FaceGroup::Filter, odfaeg::g2d::FaceGroup*> >; std::map|
D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Core\..\..\..\include\odfaeg\Core\..\Graphics\..\Graphics\2D\face.h|157|required from here|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|error: no match for 'operator<' (operand types are 'const odfaeg::g2d::FaceGroup::Filter' and 'const odfaeg::g2d::FaceGroup::Filter')|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note: candidates are:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|250|note: bool std::operator<(const std::error_condition&, const std::error_condition&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|250|note:   no known conversion for argument 1 from 'const odfaeg::g2d::FaceGroup::Filter' to 'const std::error_condition&'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|177|note: bool std::operator<(const std::error_code&, const std::error_code&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\system_error|177|note:   no known conversion for argument 1 from 'const odfaeg::g2d::FaceGroup::Filter' to 'const std::error_code&'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h|1420|note: template<class _Tp, class _Alloc> bool std::operator<(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_vector.h|1420|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::vector<_Tp, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|373|note: template<class _Tp> bool std::operator<(std::nullptr_t, const std::shared_ptr<_Tp1>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|373|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   cannot convert '__x' (type 'const odfaeg::g2d::FaceGroup::Filter') to type 'std::nullptr_t'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|368|note: template<class _Tp> bool std::operator<(const std::shared_ptr<_Tp1>&, std::nullptr_t)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|368|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::shared_ptr<_Tp1>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|359|note: template<class _Tp1, class _Tp2> bool std::operator<(const std::shared_ptr<_Tp1>&, const std::shared_ptr<_Tp2>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr.h|359|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::shared_ptr<_Tp1>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1104|note: template<class _Tp, __gnu_cxx::_Lock_policy _Lp> bool std::operator<(std::nullptr_t, const std::__shared_ptr<_Tp, _Lp>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1104|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   cannot convert '__x' (type 'const odfaeg::g2d::FaceGroup::Filter') to type 'std::nullptr_t'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1099|note: template<class _Tp, __gnu_cxx::_Lock_policy _Lp> bool std::operator<(const std::__shared_ptr<_Tp, _Lp>&, std::nullptr_t)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1099|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::__shared_ptr<_Tp, _Lp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1090|note: template<class _Tp1, class _Tp2, __gnu_cxx::_Lock_policy _Lp> bool std::operator<(const std::__shared_ptr<_Tp1, _Lp>&, const std::__shared_ptr<_Tp2, _Lp>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\shared_ptr_base.h|1090|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::__shared_ptr<_Tp1, _Lp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|540|note: template<class _Tp, class _Dp> bool std::operator<(std::nullptr_t, const std::unique_ptr<_Tp, _Dp>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|540|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   cannot convert '__x' (type 'const odfaeg::g2d::FaceGroup::Filter') to type 'std::nullptr_t'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|534|note: template<class _Tp, class _Dp> bool std::operator<(const std::unique_ptr<_Tp, _Dp>&, std::nullptr_t)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|534|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::unique_ptr<_Tp, _Dp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|523|note: template<class _Tp, class _Dp, class _Up, class _Ep> bool std::operator<(const std::unique_ptr<_Tp, _Dp>&, const std::unique_ptr<_Up, _Ep>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\unique_ptr.h|523|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::unique_ptr<_Tp, _Dp>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_multimap.h|880|note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const std::multimap<_Key, _Tp, _Compare, _Alloc>&, const std::multimap<_Key, _Tp, _Compare, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_multimap.h|880|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::multimap<_Key, _Tp, _Compare, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_map.h|978|note: template<class _Key, class _Tp, class _Compare, class _Alloc> bool std::operator<(const std::map<_Key, _Tp, _Compare, _Alloc>&, const std::map<_Key, _Tp, _Compare, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_map.h|978|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::map<_Key, _Tp, _Compare, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\tuple|822|note: template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const std::tuple<_Args1 ...>&, const std::tuple<_Args2 ...>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\tuple|822|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::tuple<_Args1 ...>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\array|238|note: template<class _Tp, unsigned int _Nm> bool std::operator<(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\array|238|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::array<_Tp, _Nm>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2593|note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2593|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   mismatched types 'const _CharT*' and 'odfaeg::g2d::FaceGroup::Filter'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2581|note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2581|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2569|note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\basic_string.h|2569|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_tree.h|914|note: template<class _Key, class _Val, class _KeyOfValue, class _Compare, class _Alloc> bool std::operator<(const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&, const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_tree.h|914|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1061|note: template<class _Iterator> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1061|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::move_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1055|note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|1055|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::move_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|347|note: template<class _IteratorL, class _IteratorR> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|347|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::reverse_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|297|note: template<class _Iterator> bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_iterator.h|297|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::reverse_iterator<_Iterator>'|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_pair.h|220|note: template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_pair.h|220|note:   template argument deduction/substitution failed:|
c:\tdm-gcc-32\lib\gcc\mingw32\4.8.1\include\c++\bits\stl_function.h|235|note:   'const odfaeg::g2d::FaceGroup::Filter' is not derived from 'const std::pair<_T1, _T2>'|
||=== Build finished: 1 errors, 25 warnings (0 minutes, 9 seconds) ===|

Here is the source code of my file :

#ifndef ODFAEG_FACE_HPP
#define ODFAEG_FACE_HPP
#include "entity.h"
#include "../vertexArray.h"
#include <map>
namespace odfaeg {
    namespace g2d {
class Material {
     private :
     struct TextureInfo {
        private :
        const Texture* texture;
        sf::IntRect rect;
        public :
        TextureInfo (const Texture* texture, sf::IntRect rect) {
            this->texture = texture;
            this->rect = rect;
        }
        bool operator== (TextureInfo& info) {
            return texture == info.texture && rect == info.rect;
        }
        const Texture* getTexture() {
            return texture;
        }
        sf::IntRect getTexRect() {
            return rect;
        }
    };
    std::vector<TextureInfo*> texInfos;
    sf::Color color;
    public :
    int getNbTextures () {
        return texInfos.size();
    }
    void addTexture (const Texture* texture, sf::IntRect rect) {
        texInfos.push_back(new TextureInfo(texture, rect));
    }
    sf::IntRect getTexRect(int textUnit = 0) {
        return (texInfos.size() > 0) ? texInfos[textUnit]->getTexRect() : sf::IntRect(0, 0, 0, 0);
    }
    Texture* getTexture(int textUnit = 0) {
        return (texInfos.size() > 0) ? texInfos[textUnit]->getTexture() : nullptr;
    }
    bool useSameTextures (Material material) {
        if (texInfos.size() != material.texInfos.size())
            return false;
        for (unsigned int i = 0; i < texInfos.size(); i++) {
            if (texInfos[i] != material.texInfos[i])
                return false;
        }
        return true;

    }
    bool hasSameColor (Material& material) {
        return color == material.color;
    }
    bool operator== (Material material) {
        return useSameTextures(material) && hasSameColor(material);
    }

};
class Face : public Entity {
public :
    Face(Vec2f position, Vec2f size, Vec2f origin, std::string type, int layer, VertexArray &vertices, Entity* parent = nullptr) : Entity(position, size, origin, type, layer, parent), vertices(vertices) {

    }
    void append(Vertex vertex) {
        vertices.append(vertex);
    }
    Material& getMaterial() {
        return material;
    }
    void addTexture (Texture *texture, sf::IntRect textRect /*= sf::IntRect(0, 0, texture->getSize().x, texture->getSize().y)*/) {
       material.addTexture(texture, textRect);
    }
    const Texture* getTexture(unsigned int texUnit = 0) {
        return material.getTexture(texUnit);

    }
    sf::IntRect getTextureRect(unsigned int texUnit = 0) {
        return material.getTexRect(texUnit);
    }
    VertexArray& getVertexArray() {
        return vertices;
    }
    bool useSameMaterial(Face& other) {
        return material == other.material;

    }
    bool useSamePrimType (Face &other) {
        return vertices.getPrimitiveType() == other.vertices.getPrimitiveType();
    }
    bool operator== (Entity& other) {
        /*if (getType() != other.getType())
            return false;
        Face& face = static_cast<Face&>(other);
        return vertices == face.vertices
        && material == face.material;*/

    }
    bool isAnimated() const {
        return false;
    }
    bool isModel() const {
        return false;
    }
    bool selectable() const {
        return true;
    }
    bool isLight() const {
        return false;
    }
    bool isShadow() const {
        return false;
    }
    bool isFace() const {
        return true;
    }

private :
    VertexArray& vertices;
    Material material;
};
class Filter {
};
class FaceGroup {
    public :
    struct Filter {
       private :
       sf::PrimitiveType prim_type;
       Material material;
       public :
       Filter (Material material, sf::PrimitiveType prim_type) {
           this->material = material;
           this->prim_type = prim_type;
       }
       void operator== (Filter& f) {
           return material == f.material && prim_type == f.prim_type;
       }
       sf::PrimitiveType get_primitive_type () {
           return prim_type;
       }
       Material get_material()  {
           return material;
       }
    };
    void addFace(Face* face) {
        faces.push_back(face);
    }
    void addFaces(std::vector<Face*>& faces) {
        this->faces.insert(this->faces.end(), faces.begin(), faces.end());
    }
    std::map<Filter, FaceGroup*> filterByMaterialAndPrimType() {
        std::map<Filter, FaceGroup*> fgs;
        std::map<Filter, FaceGroup*>::iterator it;
        for (unsigned int i = 0; i < faces.size(); i++) {
            Filter ft (faces[i]->getMaterial(), faces[i]->getVertexArray().getPrimitiveType());
            it = fgs.find(ft);
            if (it == fgs.end()) {
                fgs.insert(std::pair<Filter, FaceGroup*>(ft, new FaceGroup()));
                it = fgs.find(ft);
            }
            it->second->addFace(faces[i]);
        }
        return fgs;
    }
    bool areAllOfSameType () {
        FaceGroup fg;
        for (unsigned int i = 0; i < faces.size(); i++) {
            for (unsigned int j = 0; j < faces.size(); j++) {
                if (!(faces[i]->getMaterial() == faces[j]->getMaterial())
                    || faces[i]->getVertexArray().getPrimitiveType() != faces[j]->getVertexArray().getPrimitiveType()) {
                    return false;
                }
            }
        }
        return true;
    }
    void zSorting() {
        FaceGroup fg;
        for (unsigned int i = 0; i < faces.size() - 1; i++) {
            int zSum1 = 0;
            for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                zSum1 += faces[i]->getVertexArray()[n].position.z;
            }
            int zMoy1 = zSum1 / faces[i]->getVertexArray().getVertexCount();
            for (unsigned int j = i + 1; j < faces.size(); j++) {
                int zSum2 = 0;
                for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                    zSum2 += faces[j]->getVertexArray()[n].position.z;
                }
                int zMoy2 = zSum2 / faces[j]->getVertexArray().getVertexCount();
                Face* tmp;
                if (zSum2 < zSum1) {
                    tmp = faces[i];
                    faces[i] = faces[j];
                    faces[j] = tmp;
                }
            }
        }
    }
    void alphaSorting() {
        FaceGroup fg;
        for (unsigned int i = 0; i < faces.size() - 1; i++) {
            int aSum1 = 0;
            for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                aSum1 += faces[i]->getVertexArray()[n].color.a;
            }
            int aMoy1 = aSum1 / faces[i]->getVertexArray().getVertexCount();
            for (unsigned int j = i + 1; j < faces.size(); j++) {
                int aSum2 = 0;
                for (unsigned int n = 0; n < faces[i]->getVertexArray().getVertexCount(); n++) {
                    aSum2 += faces[j]->getVertexArray()[n].color.a;
                }
                int zMoy2 = aSum2 / faces[j]->getVertexArray().getVertexCount();
                Face* tmp;
                if (aSum2 < aSum1) {
                    tmp = faces[i];
                    faces[i] = faces[j];
                    faces[j] = tmp;
                }
            }
        }
    }
    std::vector<Face*>& getFaces() {
        faces;
    }
    ~FaceGroup() {
        for (unsigned int i = 0; i < faces.size(); i++) {
            delete faces[i];
        }
    }

private :
    std::vector<Face*> faces;
};

}
}
#endif // FACE_HPP
 

If I redefine the operator< I get a crash.

bool operator< (const Filter& filter) {
           return this < &filter;
       }
 

Here is what the debuguer show :

Code: [Select]
#0 0049198A __gnu_cxx::new_allocator<odfaeg::g2d::Face*>::construct<odfaeg::g2d::Face*<odfaeg::g2d::Face* const&> >(this=0x7efde000, __p=0xffffffff) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/ext/new_allocator.h:120)
#1 004DC447 std::allocator_traits<std::allocator<odfaeg::g2d::Face*> >::_S_construct<odfaeg::g2d::Face*<odfaeg::g2d::Face* const&> >(std::allocator<odfaeg::g2d::Face*>&, std::allocator_traits<std::allocator<odfaeg::g2d::Face*> >::__construct_helper*, (odfaeg::g2d::Face*<odfaeg::g2d::Face* const&>&&)...)(__a=..., __p=0xffffffff) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/bits/alloc_traits.h:254)
#2 004DC4DF std::allocator_traits<std::allocator<odfaeg::g2d::Face*> >::construct<odfaeg::g2d::Face*<odfaeg::g2d::Face* const&> >(std::allocator<odfaeg::g2d::Face*>&, odfaeg::g2d::Face*<odfaeg::g2d::Face* const&>*, (odfaeg::g2d::Face*<odfaeg::g2d::Face* const&>&&)...)(__a=..., __p=0xffffffff) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/bits/alloc_traits.h:393)
#3 004E9FA5 std::vector<odfaeg::g2d::Face*, std::allocator<odfaeg::g2d::Face*> >::push_back(this=0x7efde000, __x=@0x28f400: 0x32af020) (c:/tdm-gcc-32/lib/gcc/mingw32/4.8.1/include/c++/bits/stl_vector.h:905)
#4 00488F91 odfaeg::g2d::FaceGroup::addFace(this=0x7efde000, face=0x32af020) (D:/Projets/Projets-c++/ODFAEG/src/odfaeg/Graphics/2D/../../../../include/odfaeg/Graphics/2D/face.h:150)
#5 00488D2F odfaeg::g2d::FaceGroup::filterByMaterialAndPrimType(this=0x145e72c) (D:/Projets/Projets-c++/ODFAEG/src/odfaeg/Graphics/2D/../../../../include/odfaeg/Graphics/2D/face.h:165)
#6 00424DDB odfaeg::g2d::FastRenderComponent::load(this=0x145e528, visibleEntities=...) (D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Graphics\2D\fastRenderComponent.cpp:27)
#7 004174A5 odfaeg::g2d::Map::getVisibleEntities(this=0x145e370, type=...) (D:\Projets\Projets-c++\ODFAEG\src\odfaeg\Graphics\2D\map.cpp:538)
#8 0050045C getVisibleEntities(expression=...) (C:/ODFAEG/include/odfaeg/Core/world.h:35)
#9 ?? onRender (this=0x28fe30) (D:/Projets/Projets-c++/ODFAEG-DEMO/myApplication.h:220)
#10 ?? render (this=0x28fe30) (C:/ODFAEG/include/odfaeg/Core/application.h:62)
#11 ?? exec (this=0x28fe30) (C:/ODFAEG/include/odfaeg/Core/application.h:37)
#12 ?? main () (D:\Projets\Projets-c++\ODFAEG-DEMO\main.cpp:31)
« Last Edit: March 31, 2014, 11:54:32 am by Lolilolight »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Bug : filtering vertices.
« Reply #1 on: March 31, 2014, 11:51:45 am »
std::map needs an operator < to sort its keys. Or, if operator < for the key class is not relevant, you can pass a custom functor as an extra template argument to std::map.

I'm scared by all these warnings in your code. They are pretty serious, you should fix them first.
Laurent Gomila - SFML developer

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Bug : filtering vertices.
« Reply #2 on: March 31, 2014, 11:59:34 am »
Mmm..., ok, I think I'll make a std::vector of std::pair..., I really don't need to sort something here, I don't see how can I sort primitive types.

And I'll correct those warnings.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10913
    • View Profile
    • development blog
    • Email
Re: Bug : filtering vertices.
« Reply #3 on: March 31, 2014, 01:36:53 pm »
Feel free to correct me Laurent, but shouldn't we try to keep focusing on SFML related issues/topics here?
I've nothing against a few general C++ problems and most of them were often connected to SFML is some way in the past, but once you sail your own ship independently from SFML, shouldn't one be looking for a more general forum/community (e.g. StackOverflow) for general programming issues? ;)

I think, it's okay to keep updating project pages even if they don't depend on SFML anymore, but for specific issues, StackOverflow seems not only better for us, but also better for the poster, given that there are many very experienced programmers.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Bug : filtering vertices.
« Reply #4 on: March 31, 2014, 01:47:31 pm »
You're right.
Laurent Gomila - SFML developer

 

anything