Changeset 561 for trunk/config.tests/unix/stl
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/config.tests/unix/stl/stltest.cpp
r2 r561 1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 6 ** 7 ** This file is part of the config.tests of the Qt Toolkit. 8 ** 9 ** $QT_BEGIN_LICENSE:LGPL$ 10 ** Commercial Usage 11 ** Licensees holding valid Qt Commercial licenses may use this file in 12 ** accordance with the Qt Commercial License Agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** a written agreement between you and Nokia. 15 ** 16 ** GNU Lesser General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU Lesser 18 ** General Public License version 2.1 as published by the Free Software 19 ** Foundation and appearing in the file LICENSE.LGPL included in the 20 ** packaging of this file. Please review the following information to 21 ** ensure the GNU Lesser General Public License version 2.1 requirements 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 23 ** 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 ** 28 ** GNU General Public License Usage 29 ** Alternatively, this file may be used under the terms of the GNU 30 ** General Public License version 3.0 as published by the Free Software 31 ** Foundation and appearing in the file LICENSE.GPL included in the 32 ** packaging of this file. Please review the following information to 33 ** ensure the GNU General Public License version 3.0 requirements will be 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 ** 36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 ** $QT_END_LICENSE$ 39 ** 40 ****************************************************************************/ 41 1 42 /* Sample program for configure to test STL support on target 2 43 platforms. We are mainly concerned with being able to instantiate … … 9 50 #include <algorithm> 10 51 #include <iostream> 52 53 // something mean to see if the compiler and C++ standard lib are good enough 54 template<class K, class T> 55 class DummyClass 56 { 57 // everything in std namespace ? 58 typedef std::bidirectional_iterator_tag i; 59 typedef std::ptrdiff_t d; 60 // typename implemented ? 61 typedef typename std::map<K,T>::iterator MyIterator; 62 }; 63 64 // extracted from QVector's strict iterator 65 template<class T> 66 class DummyIterator 67 { 68 typedef DummyIterator<int> iterator; 69 public: 70 T *i; 71 typedef std::random_access_iterator_tag iterator_category; 72 typedef ptrdiff_t difference_type; 73 typedef T value_type; 74 typedef T *pointer; 75 typedef T &reference; 76 77 inline DummyIterator() : i(0) {} 78 inline DummyIterator(T *n) : i(n) {} 79 inline DummyIterator(const DummyIterator &o): i(o.i){} 80 inline T &operator*() const { return *i; } 81 inline T *operator->() const { return i; } 82 inline T &operator[](int j) const { return *(i + j); } 83 inline bool operator==(const DummyIterator &o) const { return i == o.i; } 84 inline bool operator!=(const DummyIterator &o) const { return i != o.i; } 85 inline bool operator<(const DummyIterator& other) const { return i < other.i; } 86 inline bool operator<=(const DummyIterator& other) const { return i <= other.i; } 87 inline bool operator>(const DummyIterator& other) const { return i > other.i; } 88 inline bool operator>=(const DummyIterator& other) const { return i >= other.i; } 89 inline DummyIterator &operator++() { ++i; return *this; } 90 inline DummyIterator operator++(int) { T *n = i; ++i; return n; } 91 inline DummyIterator &operator--() { i--; return *this; } 92 inline DummyIterator operator--(int) { T *n = i; i--; return n; } 93 inline DummyIterator &operator+=(int j) { i+=j; return *this; } 94 inline DummyIterator &operator-=(int j) { i-=j; return *this; } 95 inline DummyIterator operator+(int j) const { return DummyIterator(i+j); } 96 inline DummyIterator operator-(int j) const { return DummyIterator(i-j); } 97 inline int operator-(DummyIterator j) const { return i - j.i; } 98 }; 11 99 12 100 int main() … … 54 142 m2size = 0; 55 143 144 DummyIterator<int> it1, it2; 145 int n = std::distance(it1, it2); 146 std::advance(it1, 3); 147 56 148 return 0; 57 149 } 58 150 59 // something mean to see if the compiler and C++ standard lib are good enough60 template<class K, class T>61 class DummyClass62 {63 // everything in std namespace ?64 typedef std::bidirectional_iterator_tag i;65 typedef std::ptrdiff_t d;66 // typename implemented ?67 typedef typename std::map<K,T>::iterator MyIterator;68 };
Note:
See TracChangeset
for help on using the changeset viewer.