-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Make static_vector
"trivially relocatable" when possible
#258
Comments
upvote |
Actually aren't all Boost.Containers ('platonically') trivially relocatable (simply by the fact of not being self-referential)? static_vector should in addition be fully trivial for all trivial Ts - yet it fails for example the std::is_trivially_move_constructible check for a trivial T. |
Yes, if their components are. For example,
because such a vector's move-construct-and-destroy needs more than Also, I'm taking your word for it that "all Boost.Containers" are "not self-referential." E.g. I know Microsoft's I also agree that |
It was recently discussed on the cpplang Slack that Boost implements a lot of class types that are "Platonically trivially relocatable" without being known to the compiler to be trivially relocatable.
In P1144R9 my go-to example was
boost::movelib::unique_ptr<int>
; but in the above discussion it was pointed out thatboost::container::static_vector<int,10>
would be a less archaic example, so P1144R10 might switch to that.Executive summary: Wouldn't it be cool if we could write—
The
__is_trivially_relocatable
is available only on Clang so far, and the necessarystd::is_trivially_relocatable_v
/[[trivially_relocatable]]
trait/attribute are available only in my fork of Clang/libc++; but both levels of support are detectable via the preprocessor (see Godbolt).I propose to add an
#ifdef
so thatstatic_vector
and perhaps other containers will be recognized as trivially relocatable whenever the compiler/STL support that notion.The text was updated successfully, but these errors were encountered: