solinject  1.0.0
C++17 Dependency Injection header-only library
Utils.hpp File Reference
#include <mutex>
#include <vector>
#include <type_traits>
Include dependency graph for Utils.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  sol::di::impl::Empty
 Empty class. More...
 

Typedefs

template<class TMutex , bool isEnabled>
using sol::di::impl::DiscardableMutex = std::conditional_t< isEnabled, TMutex, Empty >
 Mutex, which can be discarded in compile-time. More...
 
template<class TMutex , bool isEnabled>
using sol::di::impl::DiscardableLock = std::conditional_t< isEnabled, std::lock_guard< TMutex >, Empty >
 Lock, which can be discarded in compile-time. More...
 
template<bool isEnabled, class... TMutexes>
using sol::di::impl::DiscardableScopedLock = std::conditional_t< isEnabled, std::scoped_lock< TMutexes... >, Empty >
 Scoped lock, which can be discarded in compile-time. More...
 

Functions

template<class T >
void sol::di::impl::ConcatenateVectors (std::vector< T > &destination, std::vector< T > source)
 Adds elements of a vector to the end of the other vector. More...
 

Typedef Documentation

◆ DiscardableLock

template<class TMutex , bool isEnabled>
using sol::di::impl::DiscardableLock = typedef std::conditional_t<isEnabled, std::lock_guard<TMutex>, Empty>

Lock, which can be discarded in compile-time.

Template Parameters
TMutexmutex type
isEnabledtrue if the lock should NOT be discarded, false otherwise

◆ DiscardableMutex

template<class TMutex , bool isEnabled>
using sol::di::impl::DiscardableMutex = typedef std::conditional_t<isEnabled, TMutex, Empty>

Mutex, which can be discarded in compile-time.

Template Parameters
TMutexmutex type
isEnabledtrue if the mutex should NOT be discarded, false otherwise

◆ DiscardableScopedLock

template<bool isEnabled, class... TMutexes>
using sol::di::impl::DiscardableScopedLock = typedef std::conditional_t<isEnabled, std::scoped_lock<TMutexes...>, Empty>

Scoped lock, which can be discarded in compile-time.

Template Parameters
TMutexesmutexes types
isEnabledtrue if the lock should NOT be discarded, false otherwise

Function Documentation

◆ ConcatenateVectors()

template<class T >
void sol::di::impl::ConcatenateVectors ( std::vector< T > &  destination,
std::vector< T >  source 
)

Adds elements of a vector to the end of the other vector.

Template Parameters
Tthe vector elements type
Parameters
destinationthe vector, to which elements should be added
sourcethe vector, whose elements should be added to destination