Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Inline specialization didn't work in GCC, use a conversion operator i…
Browse files Browse the repository at this point in the history
…nstead (lib)
  • Loading branch information
MartinBriza committed Mar 30, 2020
1 parent edb043d commit 722eb62
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/model/base_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ struct BaseModelQuery {
struct Column {
std::string name;
bool required;
// so printColumns still works
explicit operator std::string() const {
return name;
}
};
typedef std::vector<std::string> Join;
typedef std::string Table;
Expand Down Expand Up @@ -78,9 +82,6 @@ struct BaseModelQuery {
return columns_[idx].required;
}

template <typename T> static const std::string &column(const T &item) { return item; }
template <> static const std::string &column<Column>(const Column &item) { return item.name; }

/**
* @brief writes a list of columns to @ref ss
* Handles case when there's multiple tables and prepends "main" table name to columns without a dot
Expand All @@ -91,9 +92,9 @@ struct BaseModelQuery {
if (!first)
ss << ", ";
first = false;
if (!join_.empty() && column(i).find(".") == std::string::npos)
if (!join_.empty() && std::string(i).find(".") == std::string::npos)
ss << table_ << ".";
ss << column(i);
ss << std::string(i);
}
};
};
Expand Down

0 comments on commit 722eb62

Please sign in to comment.