Add OptionalOrNullptr to optional.md docs
This patch adds a mention of OptionalOrNullptr to the optional.md docs. Change-Id: I7d09afa336bcd06a11756b5d655370d162b80318 Reviewed-on: https://chromium-review.googlesource.com/965585 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: Philip Rogers <pdr@chromium.org> Cr-Commit-Position: refs/heads/master@{#543725}
This commit is contained in:

committed by
Commit Bot

parent
a7321fd950
commit
353fc9f1a0
@ -109,7 +109,9 @@ undefined value when the expected value can't be negative.
|
||||
It is recommended to not use `base::Optional<T>` as a function parameter as it
|
||||
will force the callers to use `base::Optional<T>`. Instead, it is recommended to
|
||||
keep using `T*` for arguments that can be omitted, with `nullptr` representing
|
||||
no value.
|
||||
no value. A helper, `base::OptionalOrNullptr`, is available in
|
||||
[stl_util.h](https://code.google.com/p/chromium/codesearch#chromium/src/base/stl_util.h)
|
||||
and can make it easier to convert `base::Optional<T>` to `T*`.
|
||||
|
||||
Furthermore, depending on `T`, MSVC might fail to compile code using
|
||||
`base::Optional<T>` as a parameter because of memory alignment issues.
|
||||
|
Reference in New Issue
Block a user