Question: I am trying to create smart pointer to my function.

I have the function:

```
double returnValue(int i){
       return i;
}

```

Its pretty simple to create raw pointer:

```
double (*somePTR)(int) = &returnValue;

```

But how to make smart pointer to the function, for example `shared_ptr`?

```
auto someptr = std::make_shared<double>(&returnValue);

```

I have tried a lot of of options, but nothing works.

Answer: 
**Smart pointers exist to manage the data behind the address.**

In case of a function pointer this data is program code. If the pointer runs out of scope it can't just *delete the function*.

Smart pointers can't hold function addresses because there wouldn't be any reason for them to do so.
You simply can not do that. Since you don't do memory management, like allocate dynamic memory or destroy a function when it goes out of scope, for example, it does not make sense to have a smart pointer for that. Have first a look to the intention of smart pointers and when would you use them.