/*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#ifndef FOLLY_SORTED_VECTOR_TYPES_H_
#define FOLLY_SORTED_VECTOR_TYPES_H_
-#include <vector>
#include <algorithm>
-#include <utility>
+#include <initializer_list>
#include <iterator>
+#include <utility>
+#include <vector>
#include <boost/operators.hpp>
#include <boost/bind.hpp>
#include <boost/type_traits/is_same.hpp>
insert(first, last);
}
+ explicit sorted_vector_set(
+ std::initializer_list<value_type> list,
+ const Compare& comp = Compare(),
+ const Allocator& alloc = Allocator())
+ : m_(comp, alloc)
+ {
+ insert(list.begin(), list.end());
+ }
+
key_compare key_comp() const { return m_; }
value_compare value_comp() const { return m_; }
insert(first, last);
}
+ explicit sorted_vector_map(
+ std::initializer_list<value_type> list,
+ const Compare& comp = Compare(),
+ const Allocator& alloc = Allocator())
+ : m_(value_compare(comp), alloc)
+ {
+ insert(list.begin(), list.end());
+ }
+
key_compare key_comp() const { return m_; }
value_compare value_comp() const { return m_; }
return end();
}
- size_type count(const key_type& key) {
+ size_type count(const key_type& key) const {
return find(key) == end() ? 0 : 1;
}