Skip to content

Commit 86e719d

Browse files
committed
DateTimeList: add assignment operator and default constructor
1 parent 3302036 commit 86e719d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

datetime_utils.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ template<class Time_t>
6464
class DateTimeList
6565
{
6666
public:
67+
68+
DateTimeList() = default;
69+
6770
DateTimeList(const Time_t* t, size_t nt)
6871
{
72+
matplotlibcpp::detail::_interpreter::get();
6973
tlist = (PyListObject*)toPyDateTimeList(t, nt);
7074
}
7175

@@ -74,6 +78,12 @@ class DateTimeList
7478
if(tlist) Py_DECREF((PyObject*)tlist);
7579
}
7680

81+
DateTimeList& operator=(const DateTimeList& rhs) {
82+
tlist=rhs.tlist;
83+
Py_INCREF(tlist);
84+
return *this;
85+
}
86+
7787
PyListObject* get() const { return tlist; }
7888
size_t size() const { return tlist ? PyList_Size((PyObject*)tlist) : 0; }
7989
private:

0 commit comments

Comments
 (0)