从C++14开始,constexpr函数中也可以使用循环了。
constexpr int pow(int a, int b) {
	int ans = 1;
	while (b--) {
		ans *= a;
	}
	return ans;
}
static_assert(pow(3, 4) == 81);感谢@deepbluev7:neko.dev告知。
	Except as otherwise noted, this blog is licensed under CC BY-SA 4.0 License.
	
	©2021-
	
	    searchstar
	
	
	
		|
		
			pv
			
		
		|
		 
			uv
			
		
	
	
	Theme Tree
	by Wu Jun
	Powered by Hexo