This commit is contained in:
water
2021-06-19 13:05:48 -04:00
parent 387a394be9
commit 57b2f5d72f
9 changed files with 410 additions and 143 deletions
+12
View File
@@ -67,6 +67,18 @@ std::string FieldReverseLookupOutput::Token::print() const {
}
}
std::string FieldReverseLookupOutput::print() const {
std::string result = fmt::format("[{}] {} ", result_type.print(), total_score);
if (addr_of) {
result += '&';
}
for (const auto& tok : tokens) {
result += tok.print();
result += ' ';
}
return result;
}
namespace {
void try_reverse_lookup(const FieldReverseLookupInput& input,
+1
View File
@@ -98,6 +98,7 @@ struct FieldReverseLookupOutput {
FieldReverseLookupOutput() = default;
FieldReverseLookupOutput(bool addr, TypeSpec type, std::vector<Token> tok)
: success(true), addr_of(addr), result_type(std::move(type)), tokens(std::move(tok)) {}
std::string print() const;
bool success = false;
bool addr_of = false; // do we take the address of this result?
-8
View File
@@ -1,14 +1,6 @@
#include <utility>
#include "common/util/assert.h"
/*
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args)
{
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
*/
/*!
* The CopyOnWrite class acts like a value, but internally uses references to avoid copying
* when it is possible to avoid it.