I was wondering if it was possible to detect if a given pointer to a function was allocated dynamically or not.

From what I know, dynamic memory is located on the heap, and static memory is located on the stack.

I have a particular function that I want only to accept memory that was created with the 'new' keyword, or dynamic memory.

Other wise it should return, ignoring any value submitted to it.