#if __cplusplus >= 201103L
#include <unordered_set>
#include <forward_list>
+#include <initializer_list>
#endif
#include <list>
#include <deque>
pkgCacheFile &Cache, const char * cmdline,
std::list<PkgModifier> const &mods);
- // use PackageFrom(PACKAGENAME, …) instead
- APT_DEPRECATED pkgCache::PkgIterator PackageFromName(pkgCacheFile &Cache, std::string const &pattern);
+ APT_DEPRECATED_MSG("use .PackageFrom(PACKAGENAME, …) instead") pkgCache::PkgIterator PackageFromName(pkgCacheFile &Cache, std::string const &pattern);
/** \brief be notified about the package being selected via pattern
*
*/
virtual void showPackageSelection(pkgCache::PkgIterator const &pkg, PkgSelector const select, std::string const &pattern);
// use the method above instead, react only on the type you need and let the base handle the rest if need be
- // this allows use to add new selection methods without breaking the ABI constantly with new virtual methods
- APT_DEPRECATED virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
- APT_DEPRECATED virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
- APT_DEPRECATED virtual void showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
+ // this allows us to add new selection methods without breaking the ABI constantly with new virtual methods
+ APT_DEPRECATED_MSG("override .showPackageSelection and select with switch") virtual void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
+ APT_DEPRECATED_MSG("override .showPackageSelection and select with switch") virtual void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
+ APT_DEPRECATED_MSG("override .showPackageSelection and select with switch") virtual void showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
/** \brief be notified if a package can't be found via pattern
*
*/
virtual void canNotFindPackage(enum PkgSelector const select, PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
// same as above for showPackageSelection
- APT_DEPRECATED virtual void canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
- APT_DEPRECATED virtual void canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
- APT_DEPRECATED virtual void canNotFindFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
- APT_DEPRECATED virtual void canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str);
+ APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+ APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+ APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
+ APT_DEPRECATED_MSG("override .canNotFindPackage and select with switch") virtual void canNotFindPackage(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &str);
/** \brief specifies which version(s) we want to refer to */
enum VerSelector {
*/
virtual void showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver,
enum VerSelector const select, std::string const &pattern);
- // renamed to have a similar interface to showPackageSelection
- APT_DEPRECATED virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
+ APT_DEPRECATED_MSG("use .showVersionSelection instead, similar to .showPackageSelection") virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
std::string const &ver, bool const verIsRel);
/** \brief be notified if a version can't be found for a package
* \param Pkg is the package we wanted a version from
*/
virtual void canNotFindVersion(enum VerSelector const select, VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
- // same as above for showPackageSelection
- APT_DEPRECATED virtual void canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
- APT_DEPRECATED virtual void canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+ APT_DEPRECATED_MSG("override .canNotFindVersion and select via switch") virtual void canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
+ APT_DEPRECATED_MSG("override .canNotFindVersion and select via switch") virtual void canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg);
- APT_DEPRECATED virtual void canNotFindCandInstVer(VersionContainerInterface * const vci,
+ APT_DEPRECATED_MSG("override .canNotFindVersion and select via switch") virtual void canNotFindCandInstVer(VersionContainerInterface * const vci,
pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg);
// the difference between canNotFind and canNotGet is that the later is more low-level
// and called from other places: In this case looking into the code is the only real answer…
virtual pkgCache::VerIterator canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
- // same as above for showPackageSelection
- APT_DEPRECATED virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache,
+ APT_DEPRECATED_MSG("override .canNotGetVersion and select via switch") virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg);
- APT_DEPRECATED virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache,
+ APT_DEPRECATED_MSG("override .canNotGetVersion and select via switch") virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg);
- APT_DEPRECATED virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache,
+ APT_DEPRECATED_MSG("override .canNotGetVersion and select via switch") virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache,
pkgCache::PkgIterator const &Pkg);
virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str);
}; /*}}}*/
// Iterator templates for our Containers /*{{{*/
template<typename Interface, typename Master, typename iterator_type, typename container_iterator, typename container_value> class Container_iterator_base :
- public std::iterator<typename std::iterator_traits<container_iterator>::iterator_category, container_iterator>,
+ public std::iterator<typename std::iterator_traits<container_iterator>::iterator_category, container_value>,
public Interface::template iterator_base<iterator_type>
{
protected:
inline iterator_type& operator--() { --_iter;; return static_cast<iterator_type&>(*this); }
inline iterator_type operator--(int) { iterator_type tmp(*this); operator--(); return tmp; }
inline iterator_type operator-(typename container_iterator::difference_type const &n) { return iterator_type(_iter - n); }
+ inline typename container_iterator::difference_type operator-(iterator_type const &b) { return (_iter - b._iter); }
inline iterator_type operator-=(typename container_iterator::difference_type const &n) { _iter -= n; return static_cast<iterator_type&>(*this); }
inline bool operator!=(iterator_type const &i) const { return _iter != i._iter; }
inline bool operator==(iterator_type const &i) const { return _iter == i._iter; }
operator typename Master::const_iterator() { return typename Master::const_iterator(this->_iter); }
inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
+ inline typename Container::iterator::reference operator*(void) const { return *this->_iter; }
inline typename Container::value_type getType(void) const { return *this->_iter; }
};
operator typename Master::const_iterator() { return typename Master::const_iterator(this->_iter); }
inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
+ inline typename Container::reverse_iterator::reference operator*(void) const { return *this->_iter; }
inline typename Container::value_type getType(void) const { return *this->_iter; }
};
inline const char *Name() const {return getType().Name(); }
inline std::string FullName(bool const Pretty) const { return getType().FullName(Pretty); }
inline std::string FullName() const { return getType().FullName(); }
- APT_DEPRECATED inline const char *Section() const {
+ APT_DEPRECATED_MSG("Use the .Section method of VerIterator instead") inline const char *Section() const {
APT_IGNORE_DEPRECATED_PUSH
return getType().Section();
APT_IGNORE_DEPRECATED_POP
inline pkgCache::DepIterator RevDependsList() const { return getType().RevDependsList(); }
inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
inline pkgCache::PkgIterator::OkState State() const { return getType().State(); }
- inline const char *CandVersion() const { return getType().CandVersion(); }
+ APT_DEPRECATED_MSG("This method does not respect apt_preferences! Use pkgDepCache::GetCandidateVersion(Pkg)") inline const char *CandVersion() const { return getType().CandVersion(); }
inline const char *CurVersion() const { return getType().CurVersion(); }
inline pkgCache *Cache() const { return getType().Cache(); }
inline unsigned long Index() const {return getType().Index();}
virtual void clear() = 0;
virtual size_t size() const = 0;
- // FIXME: This is a bloody hack removed soon. Use CacheSetHelper::PkgSelector !
- enum APT_DEPRECATED Constructor { UNKNOWN = CacheSetHelper::UNKNOWN,
+ enum APT_DEPRECATED_MSG("Use CacheSetHelper::PkgSelector instead") Constructor { UNKNOWN = CacheSetHelper::UNKNOWN,
REGEX = CacheSetHelper::REGEX,
TASK = CacheSetHelper::TASK,
FNMATCH = CacheSetHelper::FNMATCH };
PackageContainerInterface& operator=(PackageContainerInterface const &other);
virtual ~PackageContainerInterface();
- APT_DEPRECATED static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::TASK, …) instead") static bool FromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
return helper.PackageFrom(CacheSetHelper::TASK, pci, Cache, pattern); }
- APT_DEPRECATED static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::REGEX, …) instead") static bool FromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
return helper.PackageFrom(CacheSetHelper::REGEX, pci, Cache, pattern); }
- APT_DEPRECATED static bool FromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::FNMATCH, …) instead") static bool FromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
return helper.PackageFrom(CacheSetHelper::FNMATCH, pci, Cache, pattern); }
- APT_DEPRECATED static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::PACKAGENAME, …) instead") static bool FromGroup(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern, CacheSetHelper &helper) {
return helper.PackageFrom(CacheSetHelper::PACKAGENAME, pci, Cache, pattern); }
- APT_DEPRECATED static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFrom(CacheSetHelper::STRING, …) instead") static bool FromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
return helper.PackageFrom(CacheSetHelper::STRING, pci, Cache, pattern); }
- APT_DEPRECATED static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFromCommandLine instead") static bool FromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
return helper.PackageFromCommandLine(pci, Cache, cmdline); }
- APT_DEPRECATED typedef CacheSetHelper::PkgModifier Modifier;
+ APT_DEPRECATED_MSG("enum moved to CacheSetHelper::PkgModifier") typedef CacheSetHelper::PkgModifier Modifier;
APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
return helper.PackageFromName(Cache, pattern); }
- APT_DEPRECATED static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
+ APT_DEPRECATED_MSG("Use helper.PackageFromModifierCommandLine instead") static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
pkgCacheFile &Cache, const char * cmdline,
std::list<Modifier> const &mods, CacheSetHelper &helper) {
return helper.PackageFromModifierCommandLine(modID, pci, Cache, cmdline, mods); }
typedef Container_iterator<PackageContainerInterface, Container, PackageContainer> iterator;
typedef Container_const_reverse_iterator<PackageContainerInterface, Container, PackageContainer> const_reverse_iterator;
typedef Container_reverse_iterator<PackageContainerInterface, Container, PackageContainer> reverse_iterator;
+ typedef typename Container::value_type value_type;
+ typedef typename Container::pointer pointer;
+ typedef typename Container::const_pointer const_pointer;
+ typedef typename Container::reference reference;
+ typedef typename Container::const_reference const_reference;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::allocator_type allocator_type;
bool insert(pkgCache::PkgIterator const &P) APT_OVERRIDE { if (P.end() == true) return false; _cont.insert(P); return true; }
template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }
bool empty() const APT_OVERRIDE { return _cont.empty(); }
void clear() APT_OVERRIDE { return _cont.clear(); }
size_t size() const APT_OVERRIDE { return _cont.size(); }
-#if __cplusplus >= 201103L
+#if __GNUC__ >= 5 || (__GNUC_MINOR__ >= 9 && __GNUC__ >= 4)
iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
#else
PackageContainer() : PackageContainerInterface(CacheSetHelper::UNKNOWN) {}
explicit PackageContainer(CacheSetHelper::PkgSelector const &by) : PackageContainerInterface(by) {}
APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED PackageContainer(Constructor const &by) : PackageContainerInterface((CacheSetHelper::PkgSelector)by) {}
+ APT_DEPRECATED_MSG("Construct with a CacheSetHelper::PkgSelector instead") explicit PackageContainer(Constructor const &by) : PackageContainerInterface((CacheSetHelper::PkgSelector)by) {}
APT_IGNORE_DEPRECATED_POP
+ template<typename Itr> PackageContainer(Itr first, Itr last) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(first, last) {}
+#if __cplusplus >= 201103L
+ PackageContainer(std::initializer_list<value_type> list) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(list) {}
+ void push_back(value_type&& P) { _cont.emplace_back(std::move(P)); }
+ template<typename... Args> void emplace_back(Args&&... args) { _cont.emplace_back(std::forward<Args>(args)...); }
+#endif
+ void push_back(const value_type& P) { _cont.push_back(P); }
/** \brief sort all included versions with given comparer
\param Cache the package is in
\param pattern String the package name should be extracted from
\param helper responsible for error and message handling */
- APT_DEPRECATED static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
+ APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
return helper.PackageFromName(Cache, pattern);
}
- APT_DEPRECATED static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern) {
+ APT_DEPRECATED_MSG("Use helper.PackageFromName instead") static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern) {
CacheSetHelper helper;
return FromName(Cache, pattern, helper);
}
for (const_iterator p = begin; p != end; ++p)
_cont.push_back(*p);
}
-#if __cplusplus < 201103L
+#if APT_GCC_VERSION < 0x409
template<> inline PackageContainer<std::set<pkgCache::PkgIterator> >::iterator PackageContainer<std::set<pkgCache::PkgIterator> >::erase(iterator i) {
_cont.erase(i._iter);
return end();
inline pkgCache::PkgIterator getType(void) const { return _iter; }
};
typedef const_iterator iterator;
+ typedef pkgCache::PkgIterator value_type;
+ typedef typename pkgCache::PkgIterator* pointer;
+ typedef typename pkgCache::PkgIterator const* const_pointer;
+ typedef const pkgCache::PkgIterator& const_reference;
+ typedef const_reference reference;
+ typedef const_iterator::difference_type difference_type;
+ typedef std::make_unsigned<const_iterator::difference_type>::type size_type;
+
bool empty() const APT_OVERRIDE { return false; }
size_t size() const APT_OVERRIDE { return _cont->Head().PackageCount; }
virtual size_t size() const = 0;
/** \brief specifies which version(s) will be returned if non is given */
- enum APT_DEPRECATED Version {
+ enum APT_DEPRECATED_MSG("enum moved to CacheSetHelper::VerSelector instead") Version {
ALL = CacheSetHelper::ALL,
CANDANDINST = CacheSetHelper::CANDANDINST,
CANDIDATE = CacheSetHelper::CANDIDATE,
enum CacheSetHelper::VerSelector const select) : ID(id), Alias(alias), Pos(pos),
SelectVersion(select) {}
APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED Modifier(unsigned short const &id, const char * const alias, Position const &pos,
+ APT_DEPRECATED_MSG("Construct with a CacheSetHelper::VerSelector instead") Modifier(unsigned short const &id, const char * const alias, Position const &pos,
Version const &select) : ID(id), Alias(alias), Pos(pos),
SelectVersion((CacheSetHelper::VerSelector)select) {}
APT_IGNORE_DEPRECATED_POP
const char **cmdline, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+ APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
const char **cmdline, Version const &fallback,
CacheSetHelper &helper) {
return FromCommandLine(vci, Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
bool const onlyFromName = false);
APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+ APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
std::string pkg, Version const &fallback, CacheSetHelper &helper,
bool const onlyFromName = false) {
return FromString(vci, Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper, onlyFromName);
pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
+ APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
pkgCache::PkgIterator const &P, Version const &fallback,
CacheSetHelper &helper) {
return FromPackage(vci, Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
CacheSetHelper::VerSelector const selector,
CacheSetHelper &helper);
APT_IGNORE_DEPRECATED_PUSH
- APT_DEPRECATED static bool FromDependency(VersionContainerInterface * const vci,
+ APT_DEPRECATED_MSG("Use CacheSetHelper::VerSelector as fallback selector") static bool FromDependency(VersionContainerInterface * const vci,
pkgCacheFile &Cache,
pkgCache::DepIterator const &D,
Version const &selector,
pkgCache. */
Container _cont;
public: /*{{{*/
+
typedef Container_const_iterator<VersionContainerInterface, Container, VersionContainer> const_iterator;
typedef Container_iterator<VersionContainerInterface, Container, VersionContainer> iterator;
typedef Container_const_reverse_iterator<VersionContainerInterface, Container, VersionContainer> const_reverse_iterator;
typedef Container_reverse_iterator<VersionContainerInterface, Container, VersionContainer> reverse_iterator;
+ typedef typename Container::value_type value_type;
+ typedef typename Container::pointer pointer;
+ typedef typename Container::const_pointer const_pointer;
+ typedef typename Container::reference reference;
+ typedef typename Container::const_reference const_reference;
+ typedef typename Container::difference_type difference_type;
+ typedef typename Container::size_type size_type;
+ typedef typename Container::allocator_type allocator_type;
bool insert(pkgCache::VerIterator const &V) APT_OVERRIDE { if (V.end() == true) return false; _cont.insert(V); return true; }
template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }
bool empty() const APT_OVERRIDE { return _cont.empty(); }
void clear() APT_OVERRIDE { return _cont.clear(); }
size_t size() const APT_OVERRIDE { return _cont.size(); }
-#if __cplusplus >= 201103L
+#if APT_GCC_VERSION >= 0x409
iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
#else
reverse_iterator rend() { return reverse_iterator(_cont.rend()); }
const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }
+ VersionContainer() : VersionContainerInterface() {}
+ template<typename Itr> VersionContainer(Itr first, Itr last) : VersionContainerInterface(), _cont(first, last) {}
+#if __cplusplus >= 201103L
+ VersionContainer(std::initializer_list<value_type> list) : VersionContainerInterface(), _cont(list) {}
+ void push_back(value_type&& P) { _cont.emplace_back(std::move(P)); }
+ template<typename... Args> void emplace_back(Args&&... args) { _cont.emplace_back(std::forward<Args>(args)...); }
+#endif
+ void push_back(const value_type& P) { _cont.push_back(P); }
+
/** \brief sort all included versions with given comparer
Some containers are sorted by default, some are not and can't be,
for (const_iterator v = begin; v != end; ++v)
_cont.push_back(*v);
}
-#if __cplusplus < 201103L
+#if APT_GCC_VERSION < 0x409
template<> inline VersionContainer<std::set<pkgCache::VerIterator> >::iterator VersionContainer<std::set<pkgCache::VerIterator> >::erase(iterator i) {
_cont.erase(i._iter);
return end();