11 #include "common/datatypes/Value.h"
16 std::vector<Value> values;
21 explicit List(std::vector<Value>&& vals) {
22 values = std::move(vals);
24 explicit List(
const std::vector<Value>& l) : values(l) {}
27 return values.empty();
30 void reserve(std::size_t n) {
35 typename =
typename std::enable_if<std::is_convertible<T, Value>::value>::type>
36 void emplace_back(T&& v) {
37 values.emplace_back(std::forward<T>(v));
55 List& operator=(
List&& rhs) noexcept {
59 values = std::move(rhs.values);
63 bool operator==(
const List& rhs)
const {
64 return values == rhs.values;
67 bool operator<(
const List& rhs)
const {
68 return values < rhs.values;
71 const Value& operator[](
size_t i)
const {
75 bool contains(
const Value& value)
const {
76 return std::find(values.begin(), values.end(), value) != values.end();
83 std::string toString()
const;
86 inline std::ostream& operator<<(std::ostream& os,
const List& l) {
87 return os << l.toString();
94 struct hash<nebula::List> {
95 std::size_t operator()(
const nebula::List& h)
const noexcept {
97 for (
auto& v : h.values) {