Here is main(). just 4 lines of code...
Code:
double arr[6] {1,2,3,4,5,6}; //create sample data
BImg<double> img;
double x {5.0}; //commenting out this unrelated line makes it crash...
img.load(arr); //implicitly creates raw double pointer, crashes when assigning member "data"
Here is the class Minimal Example
Code:
template<typename T>
class BImg
{
std::shared_ptr<T> data;
BImg(){} //empty ctor
void load(T*); //see earlier definition
};
What messes me up is: when i declare & initialize some unused double x it doesn't crash.
EDIT:
I just noticed my shared_ptr is probably trying to delete something from the stack... guess I was too optimistic about the smarts of smart pointers sorry.