Implicit construct sorted_vector_set from std::initializer_list
authorQinfan Wu <wqfish@fb.com>
Tue, 4 Oct 2016 20:58:10 +0000 (13:58 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Tue, 4 Oct 2016 21:08:47 +0000 (14:08 -0700)
commit06767a9baba5f24d42884a564c4214dad6d03253
tree7ccd4094c14a54cb1736047150d2ee3b605ffeb5
parent0e125753e9054832a85511bb8c48272e603fceb5
Implicit construct sorted_vector_set from std::initializer_list

Summary:
The following thrift file doesn't work:
  typedef set<i32> (cpp.template = "folly::sorted_vector_set") IntSet
  struct Test {
    1: map<i32, IntSet> m = {7: [1, 2]},
  }

The generated file looks like this:
  Test()
      : m(std::initializer_list<
          std::pair<const int32_t, folly::sorted_vector_set<int32_t>>>{
          {7, std::initializer_list<int32_t>{1, 2}}}) {}

Given that `std::set` allows implicit construction from `std::initializer_list`, it's probably okay to make `folly::sorted_vector_set` the same.

Reviewed By: ot

Differential Revision: D3968054

fbshipit-source-id: 978d59a7e545e44d603eeb9671815ac7f2c57342
folly/sorted_vector_types.h