dlib
dlib copied to clipboard
Miscellaneous cleanup and refresh
I'm currently working on a dnn2 API. As I'm working on it, I'm spotting things in the code base that could do with a refresh. This PR proposes some of these updates:
- old type traits are now just aliases for standard library type traits
- using
is_detected
andswitch_()
in dnn core. I think it makes things clearer and trivially update-able toif constexpr
for when the time comes. - added an improved
for_each_in_tuple()
. It uses fold expression if possible otherwise the parameter pack expansion trick into dummy initializer list. This improves compile time. - Use generic lambdas where possible instead of struct helpers
- auto deduced return types
There's a whole bunch of stuff I could do to dnn/core.h, but given i'm rewriting all this stuff in dnn2, i don't see the point.
I don't think windows likes me using std::isfinite for dlib::is_finite. It looks like MSVC has a bug where it doesn't support std::isfinite
for integral types as per the standard.
See https://godbolt.org/z/51q6x9Wh5
Windows is so dumb
@davisking What do you think? Updated some things to use C++14. Re-organised some things. It was about time some of the type traits stuff just became c++11 aliases and were put in their own type_traits.h
header. Changed bits to use C++11 type traits. Basically things should phase out using the dlib type traits if possible. And dnn stuff uses switch_()
and is_detected
in some places. I think it makes things simpler and easier to read.
@davisking Do you mind having another look?
@davisking Do you mind having another look?
Yeah nice, this is great :)