mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-04-24 19:00:38 +08:00
update
This commit is contained in:
13
modern_C++_30/literalAssert/assert.cpp
Normal file
13
modern_C++_30/literalAssert/assert.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Created by light on 19-12-25.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
|
||||
int main() {
|
||||
const int alignment=5;
|
||||
assert((alignment & (alignment - 1)) == 0);
|
||||
static_assert((alignment & (alignment - 1)) == 0, "Alignment must be power of two");
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user