HACK: Static detection of infinite sequences
authorMike Curtiss <mcurtiss@fb.com>
Wed, 6 Mar 2013 07:22:54 +0000 (23:22 -0800)
committerOwen Yamauchi <oyamauchi@fb.com>
Wed, 27 Mar 2013 21:39:31 +0000 (14:39 -0700)
commitae4fa388c3a2fac5f1908f0696e22b05b76359cc
tree6724c21af9c5f3f9488c19649ac862679d682ff7
parent5c77fedbef46995a71ffa268c9fcaf49efddd01b
HACK: Static detection of infinite sequences

Summary:
Certain operations should not be performed on infinite sequences
(e.g. sorting, left-folds, summation).  In some cases, we can
detect that a sequence is infinite at compile-time and provide
a static_assert to prevent such dangerous operations.

Test Plan:
Manually created cases where the operation should
be disallowed.  Compiler correctly raised an error.

Reviewed By: tjackson@fb.com

FB internal diff: D740011
folly/experimental/FileGen-inl.h
folly/experimental/Gen-inl.h
folly/experimental/StringGen-inl.h
folly/experimental/test/GenTest.cpp