]> git.lyx.org Git - lyx.git/blobdiff - src/support/Cache.h
enhance debug message (see #13087)
[lyx.git] / src / support / Cache.h
index f1738c7147a0bc669d1fafb61c58224ffbe24726..1e44ff2f8bbb01d82614f5e1e7ad187a23e07f16 100644 (file)
@@ -33,15 +33,11 @@ namespace lyx {
  */
 template <class Key, class Val>
 class Cache : private QCache<Key, Val> {
-#if !(defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
        static_assert(std::is_copy_constructible<Val>::value,
                      "lyx::Cache only stores copyable objects!");
        static_assert(std::is_default_constructible<Val>::value,
                      "lyx::Cache only stores default-constructible objects!");
        using Q = QCache<Key, Val>;
-#else
-       typedef QCache<Key, Val> Q;
-#endif
 
 public:
        ///
@@ -60,6 +56,8 @@ public:
                        return *obj;
                return Val();
        }
+       // Version that returns a pointer, and nullptr if the object is not present
+       Val * object_ptr(Key const & key) const { return Q::object(key); }
        /// Synonymous for object, same remark as above.
        Val operator[](Key const & key) const { return object(key); }
        /// Everything from QCache except QCache::take.