This sample is licensed under the CC0 Public Domain Dedication.
Block the execution of a thread for a given amount of time.
On line 7, we create a
object representing the number of milliseconds to sleep (other
duration units may also be used). On line 8, the call to
std::this_thread::sleep_for will block
the execution of the current thread for at least the given
On line 10, we demonstrate the use of C++14’s duration literal
by representing a duration with the seconds suffix,
using directive on line 4 is required in order to use these suffixes.