Skip to content
Discussion options

You must be logged in to vote

Hi @doocman!

Thanks for bringing this example here. I think there is a solution for your case here: https://godbolt.org/z/E1Pr3ohWT. Please let me know if it helps.

The main issue you had was that QuantityOf and QuantityPointOf do not take Reference as an argument. Checking if something is a length in meters or kilometers is not particularly useful in generic algorithms. What is important here is that something is a quantity of length, and this is the semantics we provide. Checking against a specific unit is very simple if you need that.

To summarize, you need to implement your concept like this:

template <typename QP, auto R>
concept is_quantity_point_of = Reference<decltype(R)> &&
     …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@doocman
Comment options

@mpusz
Comment options

Answer selected by doocman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants