64,682
社区成员
发帖
与我相关
我的任务
分享
class PrettyMenu {
public:
void changeBackground(std::istream& imgSrc);
private:
std::tr1::shared_ptr<Image> bgImage;
Mutex mutex;
int imageChanges;
};
void PrettyMenu::changeBackground(std::istream& imgSrc) {
Lock ml(&mutex);
bgImage.reset(new Image(imgSrc)); // replace bgImage's internal
// pointer with the result of the
// "new Image" expression
++imageChanges;
}