• Yedidya Feldblum's avatar
    tweaks to DelayedInit · d8ecccad
    Yedidya Feldblum authored
    Summary:
    Tweaks to `folly::DelayedInit`:
    * No potential for ambiguity in placement-new by using `::new` and casting the address to `void*`.
    * Helper functions `slot` and `store` simplify `try_emplace_with` and `try_emplace`.
    * `try_emplace_with` and `try_emplace` are no longer `const`-qualified, removing the need for `mutable` qualifiers.
    
    The emplacement members should not be `const`-qualified since they are not semantically non-modifying. The `const` qualifier signals semantic non-modification. While it is the case that there are customs around `const` qualifiers and concurrency, these customs are not the core meaning of `const`.
    
    Reviewed By: praihan
    
    Differential Revision: D25919779
    
    fbshipit-source-id: 95e5c4b4abf5285fbb00dddda1192998baf6ee59
    d8ecccad
DelayedInit.h 5.33 KB