3

This is a follow-up question of this 5-year-old question.

N2965 was a proposal from 2009, rejected in 2011.

Is there any news about std::bases and std::direct_bases? Will we have some functionality like this? Or is this idea completely abandoned?

geza
  • 28,403
  • 6
  • 61
  • 135

1 Answers1

3

The original proposal for std::bases was rejected, in part because it arrived too late for a then immediately upcoming new standard. Seems like that specific proposal has not resurfaced again.

However, there is a new and more general proposal P0194 Static reflection that includes ways to not only interrogate base classes, but also has a much wider target.

Right now, that proposal contains some types that seems to do something like what the std::bases proposal suggested:

template <Class T> struct get_public_base_classes;
template <Class T> struct get_accessible_base_classes;
template <Class T> struct get_base_classes; 

However (again), in Herb Sutter's latest report from the ISO C++ meeting he projects these kinds of features not to appear in C++20, but perhaps in a future C++23 standard.

enter image description here

Bo Persson
  • 90,663
  • 31
  • 146
  • 203