45 lines
949 B
C++
45 lines
949 B
C++
/*
|
||
* StatusLazyFast.hpp
|
||
*
|
||
* Created on: 29 нояб. 2018 г.
|
||
* Author: titov
|
||
*/
|
||
|
||
#ifndef SOURCE_SYSTEMIC_STATUSLAZYFAST_HPP_
|
||
#define SOURCE_SYSTEMIC_STATUSLAZYFAST_HPP_
|
||
|
||
#include "IStatus.hh"
|
||
#include "IStatusOverride.hh"
|
||
|
||
namespace systemic { namespace detail {
|
||
|
||
template<typename T, bool (T::* pf)() const>
|
||
class StatusLazyFast : public IStatus {
|
||
private:
|
||
const T & object;
|
||
|
||
public:
|
||
StatusLazyFast( const T & obj );
|
||
operator bool() const final;
|
||
|
||
StatusLazyFast(const StatusLazyFast &) = delete;
|
||
StatusLazyFast & operator=(const StatusLazyFast &) = delete;
|
||
|
||
};
|
||
|
||
}
|
||
}
|
||
|
||
template<typename T, bool (T::* pf)() const>
|
||
inline systemic::detail::StatusLazyFast<T, pf>::StatusLazyFast( const T & obj ) :
|
||
object(obj) {}
|
||
|
||
template<typename T, bool (T::* pf)() const>
|
||
inline systemic::detail::StatusLazyFast<T, pf>::operator bool() const {
|
||
|
||
return (object.*pf)();
|
||
|
||
}
|
||
|
||
#endif /* SOURCE_SYSTEMIC_STATUSLAZYFAST_HPP_ */
|