google / google/fruit

Document const bindings

Open
#50 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.9k
Forks
202
PR merge metrics
No merged PRs in 30d

Description

In some use cases of `bindInstance`, people might want to bind constants. To support this use case, the following changes are needed:

* Change the normalization of `const C`, `const C&` and `const C*` to be `const C` (instead of `C`)
* Forbid binding both `const C` and `C` (with tests)
* When a `const C` binding is required, a `C` binding can satisfy this requirement (also add tests for this)
* Add tests for `bindInstance(const C&)`
* Document the caveat of `bindInstance(const C&)` (the reference must outlive the injector) and add a deleted `bindInstance(C&&)` overload to make sure temporaries are rejected.
* Update comments and wiki to mention the new kind of binding, add examples to the reference documentation

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.