ConditionallyExistent<typename>
authorYedidya Feldblum <yfeldblum@fb.com>
Fri, 5 Feb 2016 20:27:56 +0000 (12:27 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Fri, 5 Feb 2016 21:20:24 +0000 (13:20 -0800)
commitb29d023b350b6eaec52bc0b7b58fb6b2c9b0ad95
treef04212172f0392029b9490b91833e1ca863dd32c
parente0f9b5989a0cea3ae1aef97f00a3d5ca205c5e59
ConditionallyExistent<typename>

Summary:
[Folly] `ConditionallyExistent<typename>`.

For when we need extra member fields in dbg builds, but want to save the space in opt builds. Or other situations along similar lines, but with perhaps another the statically-known condition.

Conditional compilation can have some nasty side-effects. Best to avoid it. Let the compiler see everything, rather than having the preprocessor ruin our day. Let the optimizer remove code that will never be called, after the compiler has seen it. Let us have a single AST in our source file, not one AST for dbg and one for opt, or other statically-known conditions.

Reviewed By: andriigrynenko

Differential Revision: D2879397

fb-gh-sync-id: d631141a984eebd46674f27a40a97f670eb33f54
folly/ConditionallyExistent.h [new file with mode: 0644]
folly/Makefile.am
folly/Portability.h
folly/test/ConditionallyExistentTest.cpp [new file with mode: 0644]
folly/test/Makefile.am