There’s some discussion in a pull request I wanted to pull out into its own discourse thread. I’ll link this there and that here at the tops of each, for ease of reference.
In @wds15 valiant effort to get C++11 threading support in the Math lib, it was necessary to change every usage of ChainableStack to call a function to get the context. But all of these calls are nested several layers of object access deep, which is a little bit of a code smell, plus a lot of them look the same.
I would propose a small refactor where we replace many of these with calls to some wrapper function. Bob mentioned there exists one like this for C-style heap arrays, but we could also look at using something like this allocator I wrote for another PR (that I haven’t had time to finish yet). This allows us to use std::vectors that are allocated on our autodiff heap, see this (simple, WIP) test.
Maybe this refactor should come first, which would allow for two things - less files changed by the c++11 threading refactor, and a much easier possibility of an
ifdef wrapper that will allow us to support older Apple clang compilers. I would also be happy removing that latter thing as a goal, but I think the small refactor here is a good idea either way.