see my property constructor:
template <typename T>
class property
{
private:
T PropertyValue;
std::function<T(void)> getf;
std::function<void(T)> setf;
public:
property(const T &value)
{
getf=nullptr;
setf=nullptr;
PropertyValue=value;
}
property(const property &value) : PropertyValue(value.PropertyValue) , getf(value.getf)
{
}
property(std::function<T(void)> GetFunction=nullptr,std::function<void(T)> SetFunction=nullptr)
{
setf=SetFunction;
getf=GetFunction;
}
inside a class i have 2 functions:
void SetCaption(string strtext)
{
strCaption=strtext;
RECT textrect={0};
HDC txthdc=GetDC(hwnd);
DrawText (txthdc,strCaption.c_str(),strCaption.size(),&textrect,DT_CALCRECT | DT_LEFT);
SetWindowPos(hwnd, HWND_TOP, 0, 0, textrect.right-textrect.left, textrect.bottom-textrect.top, SWP_NOMOVE);
}
string GetCaption()
{
return strCaption;
}
heres how i create the property:
(to complex yes :( )
property <string> caption{std::bind(&tooltip::GetCaption, *this),std::bind(&tooltip::SetCaption, *this, std::placeholders::_1)};
no error message. but my application gives me an error(no message.. just tells me that the programs stops) and the OS closes the program.
what i'm doing wrong?