Reduce unnecessary uses of std::list

This commit is contained in:
Michael Hansen
2022-12-01 11:35:14 -08:00
parent 863e09e9e7
commit 93495c3bfb
7 changed files with 54 additions and 78 deletions

View File

@@ -3,7 +3,6 @@
#include "pyc_object.h"
#include <vector>
#include <list>
#include <set>
class PycSequence : public PycObject {
@@ -19,7 +18,7 @@ protected:
class PycTuple : public PycSequence {
public:
typedef std::vector<PycRef<PycObject> > value_t;
typedef std::vector<PycRef<PycObject>> value_t;
PycTuple(int type = TYPE_TUPLE) : PycSequence(type) { }
@@ -36,7 +35,7 @@ private:
class PycList : public PycSequence {
public:
typedef std::list<PycRef<PycObject> > value_t;
typedef std::vector<PycRef<PycObject>> value_t;
PycList(int type = TYPE_LIST) : PycSequence(type) { }
@@ -45,7 +44,7 @@ public:
void load(class PycData* stream, class PycModule* mod) override;
const value_t& values() const { return m_values; }
PycRef<PycObject> get(int idx) const override;
PycRef<PycObject> get(int idx) const override { return m_values.at(idx); }
private:
value_t m_values;
@@ -53,8 +52,8 @@ private:
class PycDict : public PycSequence {
public:
typedef std::list<PycRef<PycObject> > key_t;
typedef std::list<PycRef<PycObject> > value_t;
typedef std::vector<PycRef<PycObject>> key_t;
typedef std::vector<PycRef<PycObject>> value_t;
PycDict(int type = TYPE_DICT) : PycSequence(type) { }
@@ -75,7 +74,7 @@ private:
class PycSet : public PycSequence {
public:
typedef std::set<PycRef<PycObject> > value_t;
typedef std::set<PycRef<PycObject>> value_t;
PycSet(int type = TYPE_SET) : PycSequence(type) { }