On 7/5/21 2:56 PM, Simon wrote:

So the constructor of Solid initializes "pointer_M" which points to an object of "AnotherClass". The variable "tria_signal" in the line below is the one which causes the call of the member function &*AnotherClass<dim>::mark_for_update.
*
The above code compiles and actually calls *mark_for_update*  from *AnotherClass<dim>* .

But what I'd like to achieve is that the signal triggers a member function of 'Solid', i.e. something like &*Solid<dim>::call_this_function. *So a naive approach is to simply replace &*AnotherClass<dim>::mark_for_update*  by &*Solid<dim>::call_this_function* . (Both functions take no parameters and return void).
Unfortunately this change produces two error messages.
(i) error: pointer to member type ‘void (Solid<2>::)()’ incompatible with object type ‘AnotherClass<2>’ (ii) error: return-statement with a value, in function returning 'void' [-fpermissive]

My understanding of the error message is that only member functions of 'AnotherClass' can be connected to the signal.
Is this true?
And can I modify the parameters of the connect function somehow to actually connect a member function of Solid?

No, but you need to provide a 'this' pointer for the object you want to work on. In the first case, this is pointer_M.get(). For a member function of the current object, it would probably be 'this'.

Best
 W.


--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 bange...@colostate.edu
                           www: http://www.math.colostate.edu/~bangerth/

--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dealii+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/bd80797b-029d-a63e-1124-52a69237bab5%40colostate.edu.

Reply via email to