??????? ?????? ?????? EasyBMP ??????? ????? ???. ??? ?? ???? ????? ?? Windows, MacOS, ???????? ?-iOS, ????? ???? ???? ????? ??????????. ????? ???? ??? ????? ??, EasyBMP ???? ??? ????. ????, ??? ?????? ???? ???? ??? ?? ???? ????? ???? ?? ????? BMP. ???? ??? ??????:
BMP Player::GetCurrentFrame() { BMP frame; // Some processing here return Frame; }
??? ???? ???? ?? ????? ??? ?????? ??????? (e.g. MingGW ???? ?DevCPP)
BMP frame = player->GetCurrentFrame();
??????? ???? ?????? ??????? ?? ?????? ?? ????? ctor ??? ??? ?? ????? ???? ????? ?? ?????????. The library's author decided to go with non-compliant copy ctor somehow.
// Doesn't work - compiler fails to find the copy ctor BMP( BMP& Input ); // Should be: BMP(const BMP& Input );
?????? ????? ?? ?????? ??? ?? ?????? ?? "xxx ???? const ???????" ????? ??? ?????? ??????? ????? ????? ("Input") ???? ??????? ?const. ???? ?? ?? ??? ?? 2 ??????:
1) ???? ???? ?????? ?????? ???? ctor ?????? ??? ???? ??? constness ????? ctor ????? ??????:
BMP::BMP(const BMP& Input) { BMP(const_cast<BMP&>(Input)); }
2) ???? ???? ???? ??????? const ??? ???????????????? ???:
int TellBitDepth( void ) const; int TellWidth( void ) const; int TellHeight( void ) const; int TellNumberOfColors( void ) const; int TellVerticalDPI( void ) const; int TellHorizontalDPI( void ) const; RGBApixel* operator()(int i,int j) const; RGBApixel GetPixel( int i, int j ) const; RGBApixel GetColor( int ColorNumber ) const;
????? ??????? ???? ?????, ???? ??? ?? ?TellHorizontalDPI() (????? const) ????? ??????? ??????. ??? ??????? ?? ??, ?????? ???? ?????:
mutable int XPelsPerMeter; mutable int YPelsPerMeter;
This finally solved copy ctor problem.
???? ????? ?? ??????: ???? ????? ?? ??????? ?? ctor ????? ???? ?????? ?? ?? ?? ????????? ??? ????? ??? ???? ??????? ???. This also applied to the assignment operator.