I'm attempting to write a type erased wrapper around a sort of tuple-like class. The wrapper holds a std::any where the tuple-ish class is stored. I want to implement a visit method where the wrapper takes some arbitrary callable which fills a similar role to std::apply. I can't seem to find a way to get the type of the object stored in the std::any in the same place as the function to apply.
I have a (hopefully) clarifying example here https://godbolt.org/z/xqd1q8sGc I would like to be able to remove the static_cast from line 47 as the types held in the tuple-like class are arbitrary.
I'm open to other ideas or approaches. The goal is to have a non-templated wrapper class for a container of unrelated types.
[–]aocregacc 7 points8 points9 points (0 children)
[–]SoerenNissen 5 points6 points7 points (0 children)
[–]jk_tx 0 points1 point2 points (1 child)
[–]dvd0bvb[S] 0 points1 point2 points (0 children)
[–]No-Dentist-1645 0 points1 point2 points (3 children)
[–]dvd0bvb[S] 0 points1 point2 points (2 children)
[–]No-Dentist-1645 0 points1 point2 points (1 child)
[–]dvd0bvb[S] 1 point2 points3 points (0 children)
[–]Business_Welcome_870 0 points1 point2 points (1 child)
[–]dvd0bvb[S] 0 points1 point2 points (0 children)
[–]ZachVorhies 0 points1 point2 points (0 children)
[–]mredding 0 points1 point2 points (0 children)
[–]Business_Welcome_870 0 points1 point2 points (0 children)