+
+ bool operator!=(istring r) const
+ {
+ return !operator==(r);
+ }
+
+ inline friend std::ostream& operator<<(std::ostream& out, istring o)
+ {
+ return out << o.m_value;
+ }
+
+ const char* get() const { return m_value; }
+
+private:
+ const char* m_value;
+};
+
+struct istring_to_string
+{
+ typedef std::string result_type;
+
+ std::string operator()(istring s) const
+ {
+ return s.get();
+ }
+};
+
+// This is based on a test-case provided by Eric Neibler.
+void uniqued_return_first()
+{
+ using namespace boost::adaptors;
+
+ std::vector<istring> strs;
+ strs.push_back(istring("hello"));
+ strs.push_back(istring("hElLo"));
+ strs.push_back(istring("HELLO"));
+ strs.push_back(istring("ZZZZ"));
+
+ std::vector<istring> output1;
+
+ boost::unique_copy(strs, std::back_inserter(output1));
+
+ std::vector<istring> output2;
+ boost::push_back(output2, strs | uniqued);
+
+ std::vector<std::string> test1;
+ boost::push_back(test1, output1 | transformed(istring_to_string()));
+
+ std::vector<std::string> test2;
+ boost::push_back(test2, output2 | transformed(istring_to_string()));
+
+ BOOST_CHECK_EQUAL_COLLECTIONS(test1.begin(), test1.end(),
+ test2.begin(), test2.end());