21 #ifndef bempp_lazy_hpp
22 #define bempp_lazy_hpp
26 #include <tbb/atomic.h>
27 #include <tbb/mutex.h>
45 template<
typename T,
typename Initializer,
typename Mutex=tbb::mutex>
49 Lazy(
const Initializer& init) :
50 m_init(init), m_value() {
59 typename Mutex::scoped_lock lock(m_mutex);
61 std::auto_ptr<T> t = m_init();
62 m_value = t.release();
78 tbb::atomic<T*> m_value;
Thread-safe wrapper of a lazily inititialised object.
Definition: lazy.hpp:46