Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
vector of bool
#include <vector> #include <chrono> #include <iostream> int main() { constexpr std::size_t N = 128*1024*1024; const auto t1 = std::chrono::high_resolution_clock::now(); { std::vector<bool> x; x.resize(N); } const auto t2 = std::chrono::high_resolution_clock::now(); { std::vector<unsigned char> x; x.resize(N); } const auto t3 = std::chrono::high_resolution_clock::now(); const double delta1 = static_cast<double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t2-t1).count()); const double delta2 = static_cast<double>(std::chrono::duration_cast<std::chrono::nanoseconds>(t3-t2).count()); std::cout << "vector<bool> " << delta1 << '\n'; std::cout << "vector<unsigned char> " << delta2 << '\n'; std::cout << "factor " << (delta1/delta2) << '\n'; return 0; }
run
|
edit
|
history
|
help
0
This is the first one
Competitive - Algorithm for max number of superior characters
list multiply
cv2
karma legacy "variant" with attr_cast
not a parameter pack
Template
infix to postfix v 3.0 with improved eval()
!Enum
seh exception in constructor memory leak