Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
schema: make private constructor invokable via make_lw_shared
The schema has a private constructor, which means it can't be constructed with `make_lw_shared()` even by classes which are otherwise able to invoke the private constructor themselves. This results in such classes (`schema_builder`) resorting to building a local schema object, then invoking `make_lw_shared()` with the schema's public move constructor. Moving a schema is not cheap at all however, so each `schema_builder::build()` call results in two expensive schema construction operations. We could make `make_lw_shared()` a friend of `schema` to resolve this, but then we'd de-facto open the private consctructor to the world. Instead this patch introduces a private tag type, which is added to the private constructor, which is then made public. Everybody can invoke the constructor but only friends can create the private tag instance required to actually call it. Signed-off-by: Botond Dénes <bdenes@scylladb.com> Message-Id: <20211105085940.359708-1-bdenes@scylladb.com>
- Loading branch information