diff --git a/src/spectrum/model/spectrum-model.cc b/src/spectrum/model/spectrum-model.cc
index a9cf2de04..df05cfc88 100644
--- a/src/spectrum/model/spectrum-model.cc
+++ b/src/spectrum/model/spectrum-model.cc
@@ -77,6 +77,13 @@ SpectrumModel::SpectrumModel (const Bands& bands)
m_bands = bands;
}
+SpectrumModel::SpectrumModel (Bands&& bands)
+ : m_bands (std::move (bands))
+{
+ m_uid = ++m_uidCount;
+ NS_LOG_INFO ("creating new SpectrumModel, m_uid=" << m_uid);
+}
+
Bands::const_iterator
SpectrumModel::Begin () const
{
diff --git a/src/spectrum/model/spectrum-model.h b/src/spectrum/model/spectrum-model.h
index ba179fc36..4ca884fa9 100644
--- a/src/spectrum/model/spectrum-model.h
+++ b/src/spectrum/model/spectrum-model.h
@@ -89,7 +89,7 @@ public:
/**
- * This construct a SpectrumModel based on the explicit values of
+ * This constructs a SpectrumModel based on the explicit values of
* center frequencies and boundaries of each subband.
*
* @param bands
@@ -98,6 +98,17 @@ public:
*/
SpectrumModel (const Bands& bands);
+ /**
+ * This constructs a SpectrumModel based on the explicit values of
+ * center frequencies and boundaries of each subband. This is used
+ * if bands is an rvalue.
+ *
+ * @param bands
+ *
+ * @return
+ */
+ SpectrumModel (Bands&& bands);
+
/**
*
* @return the number of frequencies in this SpectrumModel
diff --git a/src/spectrum/model/wifi-spectrum-value-helper.cc b/src/spectrum/model/wifi-spectrum-value-helper.cc
index 26b9780b3..39edcfbb4 100644
--- a/src/spectrum/model/wifi-spectrum-value-helper.cc
+++ b/src/spectrum/model/wifi-spectrum-value-helper.cc
@@ -124,7 +124,7 @@ WifiSpectrumValueHelper::GetSpectrumModel (uint32_t centerFrequency, uint16_t ch
NS_LOG_DEBUG ("creating band " << i << " (" << info.fl << ":" << info.fc << ":" << info.fh << ")");
bands.push_back (info);
}
- ret = Create (bands);
+ ret = Create (std::move (bands));
g_wifiSpectrumModelMap.insert (std::pair > (key, ret));
}
NS_LOG_LOGIC ("returning SpectrumModel::GetUid () == " << ret->GetUid ());