dalerank / nanogui-sdl

Minimalistic port of NanoGUI claim works with SDL API w/o external dependencies.
Other
437 stars 77 forks source link

Does not compile in C++17 #56

Closed ville-v closed 2 years ago

ville-v commented 2 years ago

std::unary_function is removed in C++17, therefore nanort.h does not compile. https://en.cppreference.com/w/cpp/utility/functional/unary_function

Tested in Visual Studio 2022.

dalerank commented 2 years ago

can u fix it with pr?

ville-v commented 2 years ago

I don't know what this class does (how to replace it) and the original nanogui does not have this file. So I used another GUI library instead.

Soldy commented 2 years ago

Can I help ? https://github.com/lighttransport/nanort/blob/master/nanort.h

dalerank commented 2 years ago

Sure, is it new version?

Soldy commented 2 years ago

Sure, is it new version?

Something like a new version with an other problem: https://github.com/lighttransport/nanort/blob/0bfd8fa97e979b3636136840cbe6cc70b8bc9f08/nanort.h#L131

 class StackAllocator : public std::allocator<T> {

https://en.cppreference.com/w/cpp/memory/allocator

So isn't work with c++20

But is there anyway. https://github.com/dalerank/nanogui-sdl/blob/6785c6b617edce815ff2385d74612ef4adf7f549/sdlgui/nanort.h#L75

ville-v commented 2 years ago

I think std::allocator_traits can replace std::allocator. Nanogui-sdl uses std::allocator in some other places and replacing those was recommended by Visual Studio.

https://en.cppreference.com/w/cpp/memory/allocator_traits

According to this, std::allocator is removed because it is (at least partially) duplicate of std::allocator_traits: https://stackoverflow.com/questions/39414610/why-are-are-stdallocators-construct-and-destroy-functions-deprecated-in-c17