mardi 20 septembre 2022

Replacement for `std::bind` with Visual Studio 2019?

I've got code that compiles with Visual Studio 2017 that uses std::bind:

std::unique_lock<std::mutex>    m_lock(m_mutex_wait_for_message);
m_cond_variable.wait(m_lock, std::bind(&Logging::is_message_available, this));
std::lock_guard<std::mutex>     lock_guard(m_mutex_pushing_message);

We are now compiling using VS2019 and it's complaining with errors:
'bind': is not a member of 'std'
'bind': function does not take 2 arguments

CppReference.com says "Until C++20"

Questions:

  1. What is the replacement for std::bind in the mutex locking code above?
  2. What is the replacement for std::bind?

Aucun commentaire:

Enregistrer un commentaire