Skip to content

Instantly share code, notes, and snippets.

@wjwwood
Created March 14, 2015 00:47
Show Gist options
  • Select an option

  • Save wjwwood/47759d665a02b9f9ebf2 to your computer and use it in GitHub Desktop.

Select an option

Save wjwwood/47759d665a02b9f9ebf2 to your computer and use it in GitHub Desktop.
Example which fails to compile on Windows.
#include <chrono>
#include <condition_variable>
#include <mutex>
const std::chrono::seconds operator "" _s(unsigned long long s)
{
return std::chrono::seconds(s);
}
const std::chrono::duration<long double> operator "" _s(long double s)
{
return std::chrono::duration<long double>(s);
}
int main()
{
std::condition_variable cond;
std::mutex mutex;
std::unique_lock<std::mutex> lock(mutex);
cond.wait_for(lock, 0.5_s);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment