#pragma once #include #include namespace DB { class IAST; using ASTPtr = std::shared_ptr; /// sizeof(absl::InlinedVector) == 8 + N * 16. /// 7 elements take 120 Bytes which is ~128 using ASTs = absl::InlinedVector; } namespace std { inline typename DB::ASTs::size_type erase(DB::ASTs & asts, const DB::ASTPtr & element) { auto old_size = asts.size(); asts.erase(std::remove(asts.begin(), asts.end(), element), asts.end()); return old_size - asts.size(); } template inline typename DB::ASTs::size_type erase_if(DB::ASTs & asts, Predicate pred) { auto old_size = asts.size(); asts.erase(std::remove_if(asts.begin(), asts.end(), pred), asts.end()); return old_size - asts.size(); } }