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
Wide string to lowercase
3
Problem_rstring_1
empty base bug
MSVC_example_GetAllocLength
MSVC lambda bug
Templatized Visitor Pattern Example
Template function declaration to avoid usage of template in T::template f<int>()
masodijegy.cpp
Copy initialization: overload resolution issue