You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/07/31 12:35:41 UTC
svn commit: r681328 -
/stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp
Author: faridz
Date: Thu Jul 31 03:35:40 2008
New Revision: 681328
URL: http://svn.apache.org/viewvc?rev=681328&view=rev
Log:
2008-07-31 Farid Zaripov <fa...@apache.com>
* tests/regress/25.uninitialized.copy.stdcxx-976.cpp: New regression
test for STDCXX-976 issue.
Added:
stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp (with props)
Added: stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp?rev=681328&view=auto
==============================================================================
--- stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp (added)
+++ stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp Thu Jul 31 03:35:40 2008
@@ -0,0 +1,72 @@
+/************************************************************************
+ *
+ * 25.uninitialized.copy.stdcxx-976.cpp - regression test for STDCXX-976
+ *
+ * http://issues.apache.org/jira/browse/STDCXX-976
+ *
+ * $Id$
+ *
+ ***************************************************************************
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ *
+ **************************************************************************/
+
+#include <memory>
+#include <iterator>
+
+
+template <class T>
+struct InputIterator: std::iterator<std::input_iterator_tag, T>
+{
+ T *p_;
+
+ InputIterator (T *p): p_ (p) { }
+ InputIterator (const InputIterator &rhs): p_ (rhs.p_) { }
+
+ InputIterator& operator= (const InputIterator &rhs)
+ { p_ = rhs.p_; return *this; }
+
+ T operator* () const { return *p_; }
+
+ InputIterator& operator++ () { return ++p_, *this; }
+ InputIterator operator++ (int) {
+ return ++p_, InputIterator (p_ - 1);
+ }
+
+ bool operator== (const InputIterator &rhs) const { return p_ == rhs.p_; }
+ bool operator!= (const InputIterator &rhs) const { return p_ != rhs.p_; }
+};
+
+
+int main ()
+{
+ typedef InputIterator<char> Iter;
+ typedef InputIterator<const char> CIter;
+ typedef InputIterator<volatile char> VIter;
+ typedef InputIterator<const volatile char> CVIter;
+
+ char src [5] = "abcd";
+ char dst [5];
+
+ std::uninitialized_copy (Iter (src), Iter (src + 5), dst);
+ std::uninitialized_copy (CIter (src), CIter (src + 5), dst);
+ std::uninitialized_copy (VIter (src), VIter (src + 5), dst);
+ std::uninitialized_copy (CVIter (src), CVIter (src + 5), dst);
+
+ return 0;
+}
Propchange: stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: stdcxx/branches/4.2.x/tests/regress/25.uninitialized.copy.stdcxx-976.cpp
------------------------------------------------------------------------------
svn:keywords = Id