Skip to content

Wrong results when using non numeric type in data structure passed as argument. Some intrinsic limitations ? #963

Closed Answered by gojakuch
thelfer asked this question in Q&A
Discussion options

You must be logged in to vote

I agree that it's valid C++, although it's a confusing notation for sure. a couple of things though:

  1. you don't necessarily need to pass a function pointer to clad::differentiate. the examples you've provided would work with just passing c (not +c) or Callable::f (not &Callable::f) respectively. and while it would work with addresses to some extent, please consider the next point.

  2. Clad operates at compile time. that is, we don't really have access to the addresses at all, we can't evaluate that. what is actually passed to the differentiator in the end is the expression you put as the first argument. so even if we provide full support for this sort of expressions (the unary plus), that …

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@thelfer
Comment options

@thelfer
Comment options

@thelfer
Comment options

@gojakuch
Comment options

gojakuch Jul 2, 2024
Collaborator

Answer selected by gojakuch
@thelfer
Comment options

@gojakuch
Comment options

gojakuch Jul 3, 2024
Collaborator

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