Nui
reference.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 #include <concepts>
6 #include <functional>
7 #include <memory>
8 #include <type_traits>
9 
10 namespace Nui::Dom
11 {
12  template <typename T>
14  {
15  public:
16  explicit ReferencePasser(T&& func)
17  : func_{std::move(func)}
18  {}
19  void operator()(std::weak_ptr<BasicElement>&& weakElement) const
20  {
21  func_(std::move(weakElement));
22  }
23 
24  private:
25  std::function<void(std::weak_ptr<BasicElement>&&)> func_;
26  };
27 
28  namespace Detail
29  {
30  template <typename T>
31  struct IsReferencePasser : std::false_type
32  {};
33  template <typename T>
34  struct IsReferencePasser<ReferencePasser<T>> : std::true_type
35  {};
36  }
37 
38  template <typename T>
40  template <typename T>
42 }
Definition: basic_element.hpp:12
concept IsReferencePasser
Definition: reference.hpp:41
concept IsNotReferencePasser
Definition: reference.hpp:39
Definition: reference.hpp:32
Definition: reference.hpp:14
ReferencePasser(T &&func)
Definition: reference.hpp:16
void operator()(std::weak_ptr< BasicElement > &&weakElement) const
Definition: reference.hpp:19