Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operators for alias columns, alias columns from column pointers #1237

Merged
merged 12 commits into from
Oct 22, 2023

Conversation

trueqbit
Copy link
Collaborator

This PR further simplifies working with alias columns.

  • Alias columns can be made from a derived object member pointer without forming an explicit column pointer. E.g. instead of writing alias_column<alias_a<Derived>>(column<Derived>(&Object::field)) one can simply write alias_column<alias_a<Derived>>(&Object::field).
  • The convenience pointer-to-member operator operator->*() now also checks whether object type of a member pointer is the same as the aliased type, just like the named function alias_column().
    E.g. this means that "my"_alias.for_<Object>()->*&Object::field works, but "xyz"_alias.for_<Something>()->*&Object::field does not.
  • Overloaded operators for alias columns. One can write e.g. alias_column<myalias>(&Object::id) == 4 without "lifting" 4 into an expression using c(4), which improves legibility.

Additionally:

  • Column pointers and alias columns can now be used as constant expressions. This IMO improves the ability to create short definitions for long expressions that can be reused afterwards.
    E.g. constexpr auto reuseColumn = column_pointer<Derived>(&Object::id); or constexpr auto aliasedColumn = alias_column<alias_a<Derived>>(&Object::id);.
  • Updated vcpkg test environment on appveyor to tag "2023.10.19".

@trueqbit trueqbit requested a review from fnc12 October 20, 2023 22:00
dev/schema/table.h Outdated Show resolved Hide resolved
dev/statement_serializer.h Show resolved Hide resolved
@trueqbit trueqbit merged commit 0cf48ec into fnc12:dev Oct 22, 2023
1 check passed
@trueqbit trueqbit deleted the alias_column_operators branch October 22, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants