265818 (16) [Avatar] Offline
#1
public:
// …
operator const decltype(m_computation())& () const
{
std::call_once(m_value_flag, [this] {
m_value = m_computation();
});
return m_cache;
}
};

1) m_value is not defined
2) m_value_flag is not initialized in the lazy_val constructor
Ivan Cukic (94) [Avatar] Offline
#2
Thanks for this. The variable name should be m_cache (it is m_value in the code examples, and that name leaked into the pdf) - I'll fix that when I get the preprint pdfs.

std::once_flag m_value_flag is default-constructed, so that part is fine.