libzypp  17.38.7
poolmember.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
9 #ifndef POOLMEMBER_H_ZYPPNG_WRAPPER_H
10 #define POOLMEMBER_H_ZYPPNG_WRAPPER_H
11 
12 namespace zyppng::sat {
13 
14  class Pool;
15 
16  namespace detail {
17  // Primary templates — intentionally left undefined.
18  // Each type that inherits PoolMember<T> must provide an explicit
19  // specialization (declared in its .h, defined in its .cc).
20  // A missing specialization produces a linker error, not a silent
21  // fallback to the global singleton.
22  template <typename T> Pool & poolFromType( T & );
23  template <typename T> const Pool & poolFromType( const T & );
24  }
25 
26  template <typename Derived>
27  class PoolMember
28  {
29  public:
30  Pool & pool()
31  { return detail::poolFromType( static_cast<Derived &>( *this ) ); }
32 
33  const Pool & pool() const
34  { return detail::poolFromType( static_cast<const Derived &>( *this ) ); }
35  };
36 
37 } // namespace zyppng::sat
38 #endif // POOLMEMBER_H_ZYPPNG_WRAPPER_H
const Pool & pool() const
Definition: poolmember.h:33
Pool & poolFromType(T &)
Orchestrator for a libsolv pool instance.
Definition: pool.h:36
This file contains private API, this might break at any time between releases.
Definition: capabilities.h:22