Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Status of std::bases and std::direct_bases

Tags:

c++

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?

like image 659
geza Avatar asked Oct 17 '25 22:10

geza


1 Answers

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

like image 152
Bo Persson Avatar answered Oct 20 '25 12:10

Bo Persson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!