You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To install the library set additional cache variables _7BIT_DI_BUILD_TESTS=ON and specify installation dir with CMAKE_INSTALL_PREFIX, then run the command
46
+
To install the library set additional cache variables _7BIT_DI_INSTALL=ON and specify installation dir with CMAKE_INSTALL_PREFIX, then run the command
81
47
82
48
.. code-block:: sh
83
49
@@ -91,4 +57,4 @@ To install the library set additional cache variables _7BIT_DI_BUILD_TESTS=ON an
Copy file name to clipboardExpand all lines: Docs/advanced-guides/using-factories.rst
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,10 @@ Using Factories
2
2
========================================
3
3
4
4
Factory functor can be provided to manually create a service.
5
-
Functor should return unique_ptr or T if object is movable/copyable and should optionally take other services as arguments.
5
+
Functor should return unique_ptr or raw object if the type is movable/copyable and should optionally take other services as arguments.
6
+
6
7
Functor scheme (Services...) -> std::unique_ptr< T> | T
7
-
Where Services are pointers, inplace objects (if object is movable or copyable), unique pointers, references, vectors with pointers or unique pointers
8
+
Where Services are pointers, in-place objects (if an object is movable or copyable), unique pointers, references, vectors with pointers or unique pointers
Copy file name to clipboardExpand all lines: Docs/basic-guides/services-lifetime.rst
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,17 @@ Service providers can create scoped service providers:
9
9
10
10
ServiceProvider scoped = provider.createScope()
11
11
12
+
.. warning::
13
+
Root/main service provider cannot be destroyed before its children scoped providers this can lead to undefined behavior
14
+
12
15
Service can be registered as a singleton, scoped, or transient.
13
16
14
17
* Singleton: service provider will create only one instance of this service (accessible via the getService method)
15
18
* Scoped: instance provider will create only one instance of this instance for each scope (accessible via the getService method)
16
-
* Transient: services are always unique, a new service is provided every time it is requested, and the service provider returns, in this case, std::unique_ptr (accessible via createService method)
19
+
* Transient: services are always unique, a new service is provided every time it is requested(accessible via createService or createInstanceInPlace method)
17
20
18
21
.. warning::
19
-
Only transient services can be created using createInstance method otherwise the method will throw an exception
22
+
Only transient services can be created using createInstance/createInstanceInPlace method otherwise the method will throw an exception
20
23
21
24
Only singleton/scoped services can be accessed using the getService method otherwise the method will throw an exception
0 commit comments