fnc12 / sqlite_orm

❤️ SQLite ORM light header only library for modern C++
GNU Affero General Public License v3.0
2.19k stars 305 forks source link

Corrected self-join example #1327

Closed trueqbit closed 6 days ago

juandent commented 6 days ago

Why doesn't this code need c(" ") if it is needed at the end:

columns(alias_column<als>(&Employee::firstName) || " " || alias_column<als>(&Employee::lastName)

it is needed here:

 &Employee::firstName || c(" ") || &Employee::lastName),
trueqbit commented 6 days ago

Why doesn't this code need c(" ") if it is needed at the end:

columns(alias_column<als>(&Employee::firstName) || " " || alias_column<als>(&Employee::lastName)

it is needed here:

 &Employee::firstName || c(" ") || &Employee::lastName),

Because alias_column() returns alias_column_t<>, for which operator|| is overloaded. Unfortunately we cannot overload C++ builtin types.