mlivesu / cinolib

A generic programming header only C++ library for processing polygonal and polyhedral meshes
MIT License
930 stars 101 forks source link

fix compilation issues on VS2019 16.8.5 #122

Closed marzer closed 3 years ago

marzer commented 3 years ago

Fixes two separate small issues:

  1. An implicit conversion in std::iota caused a warning on high warning levels (therefore an error when building with /WX)
  2. C-style typedefs of anonymous structs in mesh_attributes results in a hard error with /permissive-.

On an unrelated note, the definition for uint should be a typedef, not a macro, otherwise it can wreak havoc throughout the user's code if they happen to use that name (which was true in mine). I didn't attempt this fix because the scope of the impact is undoubtedly rather large, but since I assume your uint is coming from <types.h> on linux there's no reason why you can't do this somewhere:

namespace cinolib
{
#ifdef __linux__
    using ::uint;
#else 
    using uint = unsigned int;
#endif
}
mlivesu commented 3 years ago

Thanks for the fixes. You are right, my unsigned integers come from <types.h>, so things could be implemented in the way you suggest. I don't have much time to do this right now, but I'll add it to my todo list :)