member(&Foo::getter), field(&Foo::field)

Summary: For easily calling a getter on every item in a sequence.

Test Plan: Unit tests, benchmarks

Reviewed By: mmcurtiss@fb.com

FB internal diff: D651206
make folly:make_unique support customized deleter

Summary: just follow the same template arguments as unique_ptr

Test Plan: compile

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D825025
Add QueueAppender

Summary:
Add an Appender that appends to a IOBufQueue.  You can pass in the maximum
append size if you know it, and it will throw on overflow, and will never
allocate IOBufs larger than the remaining size.

Test Plan: test added

Reviewed By: davejwatson@fb.com

FB internal diff: D820160
add openNoInt, truncateNoInt, ftruncateNoInt

Test Plan: it compiles

Reviewed By: soren@fb.com

FB internal diff: D825286
allow reading maps from number -> value

Summary:
The serialization of PHP values often uses integer -> value
maps in JSON arrays. These are emitted by the standard stream <<
operator on dynamics but cannot be read. This diff fixes that.

Test Plan: - read in serialized value with array "bucketing":{"days_stale":{0:{2:null,1:14.01,0:"more_than_two_weeks_stale"}}}

Reviewed By: delong.j@fb.com

FB internal diff: D805218
correct broken testcase

Summary:
Turns out that phabricator and arc unit do not actually run
tests in our internal repo and this one had a bunch of syntax errors.

doh

No test cases were changed, just fixing syntax.

Test Plan:
- fbconfig folly/test

- fbmake runtests

- saw all ok

- _bin/folly/test/json_test

[==========] Running 10 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 10 tests from Json
[ RUN      ] Json.Unicode
[       OK ] Json.Unicode (0 ms)
[ RUN      ] Json.Parse
[       OK ] Json.Parse (1 ms)
[ RUN      ] Json.JavascriptSafe
[       OK ] Json.JavascriptSafe (0 ms)
[ RUN      ] Json.Produce
[       OK ] Json.Produce (0 ms)
[ RUN      ] Json.JsonEscape
[       OK ] Json.JsonEscape (0 ms)
[ RUN      ] Json.JsonNonAsciiEncoding
[       OK ] Json.JsonNonAsciiEncoding (0 ms)
[ RUN      ] Json.UTF8Retention
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0528 11:29:43.879976 17977 JsonTest.cpp:257] input: ♥ => json: "♥"
I0528 11:29:43.880077 17977 JsonTest.cpp:259] output: ♥ => json: "♥"
[       OK ] Json.UTF8Retention (1 ms)
[ RUN      ] Json.UTF8EncodeNonAsciiRetention
I0528 11:29:43.880122 17977 JsonTest.cpp:284] input: ♥ => json: "\u2665"
I0528 11:29:43.880131 17977 JsonTest.cpp:286] output: ♥ => json: "\u2665"
[       OK ] Json.UTF8EncodeNonAsciiRetention (0 ms)
[ RUN      ] Json.UTF8Validation
[       OK ] Json.UTF8Validation (0 ms)
[ RUN      ] Json.ParseNonStringKeys
[       OK ] Json.ParseNonStringKeys (0 ms)
[----------] 10 tests from Json (2 ms total)

[----------] Global test environment tear-down
[==========] 10 tests from 1 test case ran. (2 ms total)
[  PASSED  ] 10 tests.

Reviewed By: delong.j@fb.com

FB internal diff: D826413

Blame Revision: D805218
HACK: New Gen operators: zip, interleave

Summary:
Zip: inspired by python's zip()
o Combine a generator with the contents of a container to form
a tuple.  Note that we combine with a container (and not
another generator) because of a fundamental constraint
in how control-flow in Generators works.  Containers give us 90%
of the utility without all the hassle.  We could theoretically
also add a version of zip where the extra source is generated
concurrently in another thread.

Interleave: similar to zip, but inspired by Clojure's interleave()
o Instead of creating a tuple like zip, just flatten the values.

Added some tuple creation/concatenation functions.  These are mostly
meant as a way to enable zip'ing multiple containers together into an
N-tuple. (My variadic-fu was not strong enough to get this working
within a single Zip function).

Test Plan: Added unit-tests

Reviewed By: tjackson@fb.com

FB internal diff: D740518
eachToTuple<Types...>()

Summary: For parsing records. `eachToPair` might be a worthwhile specialization.

Test Plan: Unit tests, benchmarks maybe?

Reviewed By: antoine@fb.com

FB internal diff: D827441
add missing include

Summary:
Newer versions of boost fail without this. I guess mutex.hpp doesn't
include lock_guard.hpp indirectly anymore, or something.

Test Plan:
built on OS X. This was part of what I had to do for my OS
X-building attempts from a few weeks ago.

Reviewed By: delong.j@fb.com

FB internal diff: D830157
make folly build on OSX

Summary:
A squash of https://github.com/danslo/folly/compare/master

Github Author: danslo

Test Plan: he said it compiles on OSX

Reviewed By: oyamauchi@fb.com

FB internal diff: D830883
revert folly/Benchmark.cpp

Summary: revert the breaking change

Test Plan: none

Reviewed By: delong.j@fb.com

FB internal diff: D832143

Blame Revision: D830883
osx on folly take 2

Summary: using ULL broke everything. Lets try the case @danslo originally suggested.

Test Plan: will check errors for this file

Reviewed By: delong.j@fb.com

FB internal diff: D832165
Make folly::allocator_delete take advantage of EBO

Summary: It wasn't.

Test Plan:
I have a case using this that now passes a static_assert
that it's the same size as the default_deleter version.  I didn't add
a static_assert in folly's tests because right now
is_simple_allocator<int,std::allocator<int>>::value is true (I think
because the tested members come from a base class), which breaks easy
test cases.

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D833142
Fix some issues in allocator_delete

Summary:
The unique_ptr implementation was getting confused about how
to determine the pointer type, so just tell it.

Facebook: Broke the fxl build; test plan included recompiling it.

Test Plan: Built.

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D834371
Folly Changes for Clang, revision 1

Summary:
Depends on D829162 and D830052

A few changes are needed to get folly compiling with clang.
There are likely more changes to compile all of folly

---folly/Bits.cpp
+++folly/folly-config.h
Moved ifunc check, and added an additional check for clang, instead of hard
coding it to be 1

~~~folly/Range.cpp
Moved the declaration of a function to get rid of clang's unused function
warning.

Test Plan:
This bit of code was a dependency in another project.
That code compiled as it needed to

See other diff for more test details

Reviewed By: oyamauchi@fb.com

FB internal diff: D830075
rework the Subprocess::communicate() API

Summary:
This eliminates the CommunicateFlags argument to communicate().  It now
always reads from both stdout and stderr if they were set up a pipes.
If a non-empty input buffer was supplied, it always writes that to
stdin.

This mimics the communicate() behavior of python's subprocess.py module.
This also makes it impossible to have buffering deadlocks by forgetting
to call communicate() with readStderr().

Test Plan:
Ran the existing subprocess tests, and also added a more complicated
duplex test that requires communication on stdin, stdout, and stderr all
at the same time.

Also grepped for all existing users of Subprocess::communicate(), and
made sure they will work correctly with the new behavior.

Reviewed By: tudorb@fb.com

FB internal diff: D814405
folly: accommodate use of -Wshadow in other projects

Summary:
Without this change, any folly-using project that attempts to enable
gcc's -Wshadow option will be overwhelmed by warnings about violations
in folly's class definitions.  Violations are often due to local
variable or parameter names shadowed by a member function.

Bracket offending content with directives like this:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
...
#pragma GCC diagnostic pop

This set of modified files is the minimal set to allow tao
to use -Wshadow with no folly-related warning.

Test Plan:
fbmake folly/test && fbmake opt

Reviewed By: simpkins@fb.com

FB internal diff: D848455
rename template parameters in folly::greater_than

Summary: This template is only used in folly::Conv (to avoid tautological comparisons) and as best as I can tell, the rhs/lhs names are not correct as it's currently used (and not consistent with `less_than`). Just swap rhs/lhs variable names.

Test Plan:
Test Results Summary:
Passed: 471
100% successful

Reviewed By: marcelo.juchem@fb.com

FB internal diff: D856785
Add MultiLevelTimeSeries to folly.

Summary:
Add MultiLevelTimeSeries class which represents a timeseries which keeps several
levels of data granularity (similar in principle to the loads reported by the
UNIX 'uptime' command).  It uses several instances (one per level) of
BucketedTimeSeries as the underlying storage.

This can easily be used to track sums (and thus rates or averages) over several
predetermined time periods, as well as all-time sums.  For example, you would
use to it to track query rate or response speed over the last 5, 15, 30, and 60
minutes.

Test Plan: unittest included.

Reviewed By: simpkins@fb.com

FB internal diff: D851444
Use libunwind instead of the heavyweight thing from libgcc

Test Plan: exception_tracer_test

Reviewed By: bmaurer@fb.com

FB internal diff: D858195