#include <unordered_map>
#include <vector>
-#include <boost/variant.hpp>
-#include <boost/mpl/contains.hpp>
-#include <boost/mpl/find.hpp>
-#include <boost/mpl/distance.hpp>
-#include <boost/mpl/begin_end.hpp>
-#include <boost/scoped_ptr.hpp>
+#include "boost/variant.hpp"
+#include "boost/mpl/contains.hpp"
+#include "boost/mpl/find.hpp"
+#include "boost/mpl/distance.hpp"
+#include "boost/mpl/begin_end.hpp"
+#include "boost/scoped_ptr.hpp"
-#include <RCSException.h>
+#include "RCSException.h"
namespace OIC
{
typedef V type;
};
- template< typename VISITOR >
+ template< typename VISITOR, typename MOVE = std::false_type >
class KeyValueVisitorHelper: public boost::static_visitor< >
{
public:
{
}
- template< typename T >
- void operator()(const std::string& key, const T& value) const
+ template< typename T, typename M = MOVE >
+ typename std::enable_if< std::is_same< M, std::false_type >::value >::type
+ operator()(const std::string& key, const T& value) const
{
m_visitor(key, value);
}
+ template< typename T, typename M = MOVE >
+ typename std::enable_if< std::is_same< M, std::true_type >::value >::type
+ operator()(const std::string& key, T& value)
+ {
+ m_visitor(key, std::move(value));
+ }
+
private:
VISITOR& m_visitor;
};
bool erase(const std::string& key);
/**
+ * Removes a single element.
+ *
+ * @param pos Iterator to the element to remove.
+ *
+ * @return Iterator following the last removed element.
+ */
+ iterator erase(const_iterator pos);
+
+ /**
* Checks this contains an element for the specified key.
*
* @param key Key to check.
}
}
+ template< typename VISITOR >
+ void visitToMove(VISITOR& visitor)
+ {
+ KeyValueVisitorHelper< VISITOR, std::true_type > helper{ visitor };
+
+ for (auto& i : m_values)
+ {
+ boost::variant< const std::string& > key{ i.first };
+ boost::apply_visitor(helper, key, *i.second.m_data);
+ }
+ }
+
private:
std::unordered_map< std::string, Value > m_values;
public:
ComparisonHelper(const Value&);
+ ComparisonHelper(const ComparisonHelper&) = delete;
+ ComparisonHelper& operator=(const ComparisonHelper&) = delete;
+
template< typename T >
typename std::enable_if< is_supported_type< T >::value, bool >::type equals(
const T& v) const
public:
iterator();
- iterator(const iterator&) = default;
+ iterator(const iterator&);
- iterator& operator=(const iterator&) = default;
+ iterator& operator=(const iterator&);
reference operator*();
pointer operator->();
* @see iterator
*/
class RCSResourceAttributes::const_iterator:
- public std::iterator < std::forward_iterator_tag,
+ public std::iterator< std::forward_iterator_tag,
const RCSResourceAttributes::KeyValuePair >
{
private:
public:
const_iterator();
- const_iterator(const const_iterator&) = default;
+ const_iterator(const const_iterator&);
const_iterator(const RCSResourceAttributes::iterator&);
- const_iterator& operator=(const const_iterator&) = default;
+ const_iterator& operator=(const const_iterator&);
const_iterator& operator=(const RCSResourceAttributes::iterator&);
reference operator*() const;