summaryrefslogtreecommitdiff
path: root/include/mbgl/util/ignore.hpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-02-21 13:46:43 -0800
committerKonstantin Käfer <mail@kkaefer.com>2017-03-28 13:53:19 +0200
commit54cbdc4812c52894b1dbb34c786769e852f84f8c (patch)
treef6255f4cdc86c7b1d13415e6d3fa8d92ac21b82c /include/mbgl/util/ignore.hpp
parent3db027751ed79832fccd769f2f5754d24c342a8a (diff)
downloadqtlocation-mapboxgl-54cbdc4812c52894b1dbb34c786769e852f84f8c.tar.gz
[core] Move ignore.hpp to public include directory
Diffstat (limited to 'include/mbgl/util/ignore.hpp')
-rw-r--r--include/mbgl/util/ignore.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/mbgl/util/ignore.hpp b/include/mbgl/util/ignore.hpp
new file mode 100644
index 0000000000..577bcf4d91
--- /dev/null
+++ b/include/mbgl/util/ignore.hpp
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <initializer_list>
+
+namespace mbgl {
+namespace util {
+
+// Accept any number of parameters of any types, and do nothing with them.
+// Useful for providing a context for parameter pack expansion where a legal
+// expansion context is not otherwise available.
+//
+// See https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md
+// for more details.
+//
+template <class... Ts> void ignore(Ts&&...) {}
+
+// std::initializer_list overload, for situations where you need sequenced
+// modifications.
+//
+template <class T> void ignore(const std::initializer_list<T>&) {}
+
+// Handle the zero-argument case.
+inline void ignore(const std::initializer_list<int>&) {}
+
+} // namespace util
+} // namespace mbgl