Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/include/composite_injector.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,20 @@ private:
INJECTOR_1 injector_1;
INJECTOR_2 injector_2;
};

/// @brief Helper method to deduce the type of a composite injector, enabling
/// e.g. `auto composite_injector = make_composite(injector_1, injector_2);`
///
/// Wouldn't be necessary in C++17; see
/// https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rt-deduce.
/// @tparam INJECTOR_1 first type of injector
/// @tparam INJECTOR_2 second type of injector
/// @param injector_1 first injector
/// @param injector_2 second injector
/// @return
template <typename INJECTOR_1, typename INJECTOR_2>
CompositeInjector<INJECTOR_1, INJECTOR_2> make_composite(INJECTOR_1 injector_1,
Comment thread
JamesMcClung marked this conversation as resolved.
INJECTOR_2 injector_2)
{
return CompositeInjector<INJECTOR_1, INJECTOR_2>(injector_1, injector_2);
}