c_cpp meow.cpp

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp meow.cpp相关的知识,希望对你有一定的参考价值。

struct meow {
	static int defaults;
	static int copies;
	static int moves;
	static int destroys;
	
	static void report() {
		std::cout << "defaults: " << defaults << std::endl;
		std::cout << "copies: " << copies << std::endl;
		std::cout << "moves: " << moves << std::endl;
		std::cout << "destroys: " << destroys << std::endl;
	}
	
	bool moved = false;
	
	meow() {
		std::cout << __PRETTY_FUNCTION__ << std::endl;
		++defaults;
	}
	
	meow(const meow&) {
		std::cout << __PRETTY_FUNCTION__ << std::endl;
		++copies;
	}
	
	meow(meow&& rhs) {
		std::cout << __PRETTY_FUNCTION__ << std::endl;
		rhs.moved = true;
		++moves;
	}
	
	~meow() {
		std::cout << __PRETTY_FUNCTION__;
		
		if (!moved) {
			std::cout << " (not moved!)";
		}
		
		std::cout << std::endl;
		++destroys;
	}
};

int meow::defaults = 0;
int meow::copies = 0;
int meow::moves = 0;
int meow::destroys = 0;

以上是关于c_cpp meow.cpp的主要内容,如果未能解决你的问题,请参考以下文章

c_cpp 200.岛屿数量

c_cpp 127.单词阶梯

c_cpp MOFSET

c_cpp MOFSET

c_cpp 31.下一个排列

c_cpp string→char *