summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/pbd/id.cc14
-rw-r--r--libs/pbd/pbd/id.h4
2 files changed, 17 insertions, 1 deletions
diff --git a/libs/pbd/id.cc b/libs/pbd/id.cc
index 25c96c305e..b96863b0fa 100644
--- a/libs/pbd/id.cc
+++ b/libs/pbd/id.cc
@@ -48,6 +48,11 @@ ID::ID ()
_id = _counter++;
}
+ID::ID (const ID& other)
+{
+ _id = other._id;
+}
+
ID::ID (string str)
{
string_assign (str);
@@ -85,6 +90,15 @@ ID::operator= (string str)
return *this;
}
+ID&
+ID::operator= (const ID& other)
+{
+ if (&other != this) {
+ _id = other._id;
+ }
+ return *this;
+}
+
ostream&
operator<< (ostream& ostr, const ID& _id)
{
diff --git a/libs/pbd/pbd/id.h b/libs/pbd/pbd/id.h
index d25ca81ef0..7a32a29002 100644
--- a/libs/pbd/pbd/id.h
+++ b/libs/pbd/pbd/id.h
@@ -31,7 +31,8 @@ class ID {
public:
ID ();
ID (std::string);
-
+ ID (const ID&);
+
bool operator== (const ID& other) const {
return _id == other._id;
}
@@ -43,6 +44,7 @@ class ID {
bool operator== (const std::string&) const;
ID& operator= (std::string);
+ ID& operator= (const ID&);
bool operator< (const ID& other) const {
return _id < other._id;