Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 726 Bytes

note.c++.template_reference_compare_derived.md

File metadata and controls

34 lines (27 loc) · 726 Bytes
id title desc updated created
dc30nxn4plhkb3drdw9hb08
Template_reference_compare_derived
1692784380330
1692782957390

template type reference obj pass

  template<typename _Mutex>
    class lock_guard
    {
    public:
      typedef _Mutex mutex_type;

      explicit lock_guard(mutex_type& __m) : _M_device(__m)
      { _M_device.lock(); }

      lock_guard(mutex_type& __m, adopt_lock_t) noexcept : _M_device(__m)
      { } // calling thread owns mutex

      ~lock_guard()
      { _M_device.unlock(); }

      lock_guard(const lock_guard&) = delete;
      lock_guard& operator=(const lock_guard&) = delete;

    private:
      mutex_type&  _M_device;
    };

force implicit require obj action