[SERVER-84174] Use concepts to ensure correct types for InlinedStorage and DynamicBitset Created: 14/Dec/23  Updated: 14/Dec/23  Resolved: 14/Dec/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.3.0-rc0

Type: Task Priority: Minor - P4
Reporter: Alexander Ignatyev Assignee: Alexander Ignatyev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

Since InlinedStorage uses 'union' internally it does not support C++ types with non trivial initialization or clean up, therefore, we need to impose restrictions on the types with which the template classes in question can be instantiated



 Comments   
Comment by Billy Donahue [ 14/Dec/23 ]

Could you do this with static_assert instead?
clang-format doesn't understand the requires clauses.

We don't really need concepts for this since there is no alternative selection or overloading here.
We're just basically making static assertions.

Comment by Githook User [ 14/Dec/23 ]

Author:

{'name': 'Alexander Ignatyev', 'email': 'alexander.ignatyev@mongodb.com', 'username': 'aligusnet'}

Message: SERVER-84174 Use concepts to ensure correct types for InlinedStorage and DynamicBitset

InlinedStorage uses union and, therefore, can be instantiated with trivial types only.
And only integers can be used to store blocks of DynamicBitset.

GitOrigin-RevId: 5506cf9a798de8413debad0eaa4993c299bd50dd
Branch: master
https://github.com/mongodb/mongo/commit/bf039e1c05da6b5bdd3339e8f9c8d14947ee8081

Generated at Thu Feb 08 06:54:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.