Add missing uint32 type to folly::ProgramOptions::gFlagAdders
[folly.git] / folly / ContainerTraits.h
1 /*
2  * Copyright 2017 Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #pragma once
18
19 #include <folly/Traits.h>
20
21 namespace folly {
22
23 FOLLY_CREATE_HAS_MEMBER_FN_TRAITS(container_emplace_back_traits, emplace_back);
24
25 template <class Container, typename... Args>
26 inline
27 typename std::enable_if<
28     container_emplace_back_traits<Container, void(Args...)>::value>::type
29 container_emplace_back_or_push_back(Container& container, Args&&... args) {
30   container.emplace_back(std::forward<Args>(args)...);
31 }
32
33 template <class Container, typename... Args>
34 inline
35 typename std::enable_if<
36     !container_emplace_back_traits<Container, void(Args...)>::value>::type
37 container_emplace_back_or_push_back(Container& container, Args&&... args) {
38   using v = typename Container::value_type;
39   container.push_back(v(std::forward<Args>(args)...));
40 }
41
42 }