Thread: [complement-svn] SF.net SVN: complement: [1439] trunk/complement/explore/inquiry/STLport
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-12-12 08:19:19
|
Revision: 1439 http://svn.sourceforge.net/complement/?rev=1439&view=rev Author: complement Date: 2006-12-12 00:19:17 -0800 (Tue, 12 Dec 2006) Log Message: ----------- bug in STLport 5.0.x Added Paths: ----------- trunk/complement/explore/inquiry/STLport/multimap/ trunk/complement/explore/inquiry/STLport/multimap/Makefile trunk/complement/explore/inquiry/STLport/multimap/Makefile.inc trunk/complement/explore/inquiry/STLport/multimap/TestSTLHash.cpp Property changes on: trunk/complement/explore/inquiry/STLport/multimap ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/multimap/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/multimap/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/multimap/Makefile 2006-12-12 08:19:17 UTC (rev 1439) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) Added: trunk/complement/explore/inquiry/STLport/multimap/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/multimap/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/multimap/Makefile.inc 2006-12-12 08:19:17 UTC (rev 1439) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = testhash +SRC_CPP = TestSTLHash.cpp Added: trunk/complement/explore/inquiry/STLport/multimap/TestSTLHash.cpp =================================================================== --- trunk/complement/explore/inquiry/STLport/multimap/TestSTLHash.cpp (rev 0) +++ trunk/complement/explore/inquiry/STLport/multimap/TestSTLHash.cpp 2006-12-12 08:19:17 UTC (rev 1439) @@ -0,0 +1,133 @@ +// TestSTLHash.cpp +// Short demonstrator that helps reproducing a bug in the hash-table implementation +// of STLPort 5.0.1/5.0.2 when using Microsoft Visual C++ 2005 on Windows XP. +// +// Problem: Fill a hash_multimap with entries of which many have the same key +// Internally, entries with the same key are kept as one block within the same bucket. +// Thus, when calling equal_range(key) the begin/end of that block is returned. +// However, this code shows that for key =3, that block is destroyed after inserting the 194th element. +// According to _hashtable.c we will have a rehash from size 193 to size 389 in that situation. +// After that rehash, equal_range only returns 2 elements with key = 3 whereas there are 65 in it. +// Reproduction: +// In the main()-method we fill a hash_multimap as well as a multi_map with the same <key, data> pairs +// After each insertion we call CHECK(...) to assure validity of these two containers. +// This works fine up to the 193th insertion. Insertion 194 generates the bug. +// +// CHECK() works as follows: +// (a) we check whether both containers contain the same number of elements. +// (b) Assuming that the multi_map works correctly, we iterate over all its elements and check +// whether we can find that key also in the hash_multimap. We collect all data for that specific +// key in in a set ("collection"). Notice that data is unique by construction in main(), thus the +// number of elements in the set must equal the number of entries in the hash_multimap and in the multimap +// (c) We check if we have seen as many data elements in collection as we have seen in the multimap. +// if so, we print "OK", otherwise we print a detailed key/data overview and assert. +// Caution: +// There are several configurations of the program that will NOT fail. (see comment in main()) +// E.g. it seems that whenever the keys are more or less sorted, the problem does not occur. +// Also, using numbers from 200 downto 1 or from 300 downto 1 cannot generate the problem, +// whereas using 400 downto 1 will fail. +// Finally, if we use key 1 (rather than key 3) we cannot generate a problem. + +// #define _STLP_DEBUG + +#include <iostream> +#include <hash_map> +#include <map> +#include <set> +#include <cassert> + +using namespace std; + +typedef hash_multimap<int, int> hashType ; +typedef multimap<int, int> mapType ; + + +void check(hashType &h, mapType &m) +{ + set<int> collection; + + // (a) check sizes + assert (h.size() == m.size()); + cout << "Checking Hash-Size: " << static_cast<unsigned>(h.size()) ; + + // (b) iterate over multi_map + for (mapType::iterator mIter = m.begin(); mIter != m.end(); mIter++) + { + // look up that key in hash-table and keep all data in the set + pair<hashType::iterator,hashType::iterator> range = h.equal_range(mIter->first); + for (hashType::iterator h = range.first; h != range.second; h++) + { + collection.insert (h->second); + } + } + + // (c) we should have seen as many elements as there are in the hash-table + if (collection.size() == h.size()) cout << " OK" << endl; + else + { + // if not, please report + cout << " FAILED: " << endl; + int lastKey = -1; + // iterate over all elements in multi_map + for (mapType::iterator mIter = m.begin(); mIter != m.end(); mIter++) + { + // new key? print a new status line + if (mIter->first != lastKey) + { + cout << endl << "Key : " << mIter->first << endl; + lastKey = mIter->first; + + // print all hashed values for that key + cout << " data in hash: "; + pair<hashType::iterator,hashType::iterator> range = h.equal_range(mIter->first); + for (hashType::iterator h = range.first; h != range.second; h++) + { + assert (h->first == lastKey); + cerr << h->second << ", "; // print all data for that key in Hash-Table + } + cout << endl << " data in map: "; + } + // and print all member in multi-map until the next key occurs + cout << mIter->second << ", " ; // print all data for that key in Map + } + } + assert (collection.size() == h.size()); // stopper + +} + + +int main(int argc, char* argv[]) +{ + hashType h; + mapType m; + + // CAUTION the following configurations WORKS in our setting + // for (int id = 1; id != 400; id ++) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 200; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 300; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 400; id != 1; id --) and int key = (id %3 == 0 ? 1 : id) + // for (int id = 4000; id != 1; id --) and int key = (id %3 == 0 ? 1 : id) + // + // whereas these will FAIL + // for (int id = 400; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // for (int id = 4000; id != 1; id --) and int key = (id %3 == 0 ? 3 : id) + // + + for (int id = 400; id != 1; id --) + { + // generate many entries with key 3, fill up with unique keys. Data is unique (needed in check()) + int key = (id %3 == 0 ? 3 : id); + + // keep hash_multi_map and multimap in sync + h.insert (make_pair(key, id)); + m.insert (make_pair(key, id)); + + // check whether both contain the same elements + check(h,m); + } + + return 0; +} + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-29 13:24:44
|
Revision: 1466 http://svn.sourceforge.net/complement/?rev=1466&view=rev Author: complement Date: 2006-12-29 05:24:41 -0800 (Fri, 29 Dec 2006) Log Message: ----------- function return: increment operator for POD and non-pod; memfunc Added Paths: ----------- trunk/complement/explore/inquiry/STLport/mem_func/ trunk/complement/explore/inquiry/STLport/mem_func/Makefile trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc trunk/complement/explore/inquiry/STLport/mem_func/mm.cc trunk/complement/explore/inquiry/STLport/tmp_iter/ trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc Property changes on: trunk/complement/explore/inquiry/STLport/mem_func ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/mem_func/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/mem_func/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/mem_func/Makefile 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) + Added: trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/mem_func/Makefile.inc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = mm.cc Added: trunk/complement/explore/inquiry/STLport/mem_func/mm.cc =================================================================== --- trunk/complement/explore/inquiry/STLport/mem_func/mm.cc (rev 0) +++ trunk/complement/explore/inquiry/STLport/mem_func/mm.cc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,39 @@ +#include <iostream> +#include <string> +#include <vector> +#include <functional> +#include <algorithm> + +class Person +{ + private: + std::string name; + + public: + //... + void print () const + { std::cout << name << std::endl; } + + void printWithPrefix (std::string prefix) const + { std::cout << prefix << name << std::endl; } +}; + +void foo (const std::vector<Person>& coll) +{ + using std::for_each; + using std::bind2nd; + using std::mem_fun_ref; + + // call member function print() for each element + for_each( coll.begin(), coll.end(), mem_fun_ref(&Person::print) ); + + // call member function printWithPrefix() for each element + // - "person: " is passed as an argument to the member function + for_each( coll.begin(), coll.end(), bind2nd(mem_fun_ref(&Person::printWithPrefix), "person: ") ); + for_each( coll.begin(), coll.end(), bind2nd(mem_fun_ref(&Person::printWithPrefix), std::string("person: ") ) ); +} + +int main() +{ + return 0; +} Property changes on: trunk/complement/explore/inquiry/STLport/tmp_iter ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) + Added: trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/tmp_iter/Makefile.inc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc =================================================================== --- trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc (rev 0) +++ trunk/complement/explore/inquiry/STLport/tmp_iter/test.cc 2006-12-29 13:24:41 UTC (rev 1466) @@ -0,0 +1,67 @@ +/* +end() return rvalue (Standard, 3.10 par. 5) + +If this is a POD, increment/decrement operators invalid in this context; +If this is user-defined object, temporary object created from rvalue +(Standard, 12.2; 6.6.3) and increment/decrement operators may be valid; + +Usage POD type for string iterator is effective and don't contradict to +Standard. + +So the code + +char c = *(--s.end()); + +is implementation-specific and that's why not good. + +[this is explanation why this code work if begin() return v, but not work +when end() return char *; inspired by string::iterator] +*/ +#include <string> + +using namespace std; + +class v +{ + public: + v& operator ++() { return *this; } +}; + +class vconst +{ + public: + vconst& operator ++() { return *this; } +}; + + +class q +{ + public: + v begin() + { return v(); } + + vconst begin() const + { return vconst(); } + + char *end() + { return 0; } + + private: +}; + +int main() +{ + q x; + + ++x.begin(); + ++x.end(); + + // string s( "123456" ); + + // --s.end(); + + // char c = *(--s.end()); + + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-01-30 15:14:25
|
Revision: 1487 http://svn.sourceforge.net/complement/?rev=1487&view=rev Author: complement Date: 2007-01-30 07:14:17 -0800 (Tue, 30 Jan 2007) Log Message: ----------- problems, when we overload address operator (&) Added Paths: ----------- trunk/complement/explore/inquiry/STLport/address/ trunk/complement/explore/inquiry/STLport/address/Makefile trunk/complement/explore/inquiry/STLport/address/Makefile.inc trunk/complement/explore/inquiry/STLport/address/test.cc Property changes on: trunk/complement/explore/inquiry/STLport/address ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/address/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/address/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/address/Makefile 2007-01-30 15:14:17 UTC (rev 1487) @@ -0,0 +1,10 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) + Added: trunk/complement/explore/inquiry/STLport/address/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/address/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/address/Makefile.inc 2007-01-30 15:14:17 UTC (rev 1487) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/STLport/address/test.cc =================================================================== --- trunk/complement/explore/inquiry/STLport/address/test.cc (rev 0) +++ trunk/complement/explore/inquiry/STLport/address/test.cc 2007-01-30 15:14:17 UTC (rev 1487) @@ -0,0 +1,31 @@ +/* +Overload of address operator (&), that return double, not v *; no way to take +address of object of type v; may be constructor v(double) and convert to double can help... +*/ +#include <vector> + +using namespace std; + +class v +{ + private: + double p[3]; + + public: + v() {} + v( double ) {} + + double *operator &() { return p; } + const double *operator &() const { return p; } + double() const { return p[0]; } +}; + +int main() +{ + vector<v> vec; + + vec.push_back( v() ); + + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-02-05 13:09:05
|
Revision: 1509 http://svn.sourceforge.net/complement/?rev=1509&view=rev Author: complement Date: 2007-02-05 05:09:03 -0800 (Mon, 05 Feb 2007) Log Message: ----------- sample: link with boost's utf Added Paths: ----------- trunk/complement/explore/inquiry/STLport/boost-sample/ trunk/complement/explore/inquiry/STLport/boost-sample/Makefile trunk/complement/explore/inquiry/STLport/boost-sample/Makefile.inc trunk/complement/explore/inquiry/STLport/boost-sample/test_parser_lowlevel4.cpp Property changes on: trunk/complement/explore/inquiry/STLport/boost-sample ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/boost-sample/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/boost-sample/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/boost-sample/Makefile 2007-02-05 13:09:03 UTC (rev 1509) @@ -0,0 +1,15 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I$(SRCROOT)/include -I$(BOOST_INCLUDE_DIR) + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR):${CoMT_LIB_DIR} + +release-shared : LDLIBS = -L${CoMT_LIB_DIR} -lboost_test_utf +stldbg-shared : LDLIBS = -L${CoMT_LIB_DIR} -lboost_test_utfstlg +dbg-shared : LDLIBS = -L${CoMT_LIB_DIR} -lboost_test_utfg Added: trunk/complement/explore/inquiry/STLport/boost-sample/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/boost-sample/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/boost-sample/Makefile.inc 2007-02-05 13:09:03 UTC (rev 1509) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CPP = test_parser_lowlevel4.cpp Added: trunk/complement/explore/inquiry/STLport/boost-sample/test_parser_lowlevel4.cpp =================================================================== --- trunk/complement/explore/inquiry/STLport/boost-sample/test_parser_lowlevel4.cpp (rev 0) +++ trunk/complement/explore/inquiry/STLport/boost-sample/test_parser_lowlevel4.cpp 2007-02-05 13:09:03 UTC (rev 1509) @@ -0,0 +1,68 @@ +// g++ -g -Wall -o test_parser_lowlevel4 test_parser_lowlevel4.cpp `pkg-config --cflags --libs avisynth-3.0` -lboost_unit_test_framework-gcc-mt-p-1_33_1 -lboost_thread-gcc-mt-p-1_33_1 + +// g++ -g -Wall -o test_parser_lowlevel4 test_parser_lowlevel4.cpp -I$HOME/local/include/boost-1_33_1 -pthread -L$HOME/local/lib -lboost_unit_test_framework-gcc-mt-p-1_33_1 -lboost_thread-gcc-mt-p-1_33_1 + + + +// STL includes +#include <iostream> +#include <sstream> +#include <string> + +// Boost includes +#include <boost/test/unit_test.hpp> + +struct parse_test +{ +private: + + std::string msg_; + +public: // constructor + + parse_test (std::string const& msg) + : msg_(msg) { } + +public: // tests + + void test_integer (); + +private: + + std::string parse_script (std::string const& src); +}; + +void parse_test::test_integer () +{ + BOOST_CHECK_EQUAL (parse_script ("2"), "2"); + BOOST_CHECK_EQUAL (parse_script ("3"), "2"); +} + +std::string parse_test::parse_script (std::string const& src) +{ + return src; +} + +struct parse_test_suite : public boost::unit_test::test_suite +{ + parse_test_suite (std::string const& msg) + : test_suite ("low level test") + { + boost::shared_ptr<parse_test> instance (new parse_test (msg)); + + boost::unit_test::test_case *integer_test_case = + BOOST_CLASS_TEST_CASE (&parse_test::test_integer, instance); + add (integer_test_case, 1); + } +}; + +boost::unit_test::test_suite * +init_unit_test_suite (int argc, char *argv[]) +{ + boost::unit_test::test_suite *tests = BOOST_TEST_SUITE ("unit test"); + std::string msg = "2"; + + tests->add (new parse_test_suite (msg)); + + return tests; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-09-28 10:41:40
|
Revision: 1750 http://complement.svn.sourceforge.net/complement/?rev=1750&view=rev Author: complement Date: 2007-09-28 03:41:29 -0700 (Fri, 28 Sep 2007) Log Message: ----------- investigation of merge/size problem with some compilers Added Paths: ----------- trunk/complement/explore/inquiry/STLport/merge/ trunk/complement/explore/inquiry/STLport/merge/Makefile trunk/complement/explore/inquiry/STLport/merge/Makefile.inc trunk/complement/explore/inquiry/STLport/merge/test.cc Property changes on: trunk/complement/explore/inquiry/STLport/merge ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/merge/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/merge/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/merge/Makefile 2007-09-28 10:41:29 UTC (rev 1750) @@ -0,0 +1,14 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +# COMPILER_NAME := gcc + +STLPORT_DIR := /export/home/ptr/STLport.lab/STLport +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + + +INCLUDES += -I$(SRCROOT)/include + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) + Added: trunk/complement/explore/inquiry/STLport/merge/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/merge/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/merge/Makefile.inc 2007-09-28 10:41:29 UTC (rev 1750) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/STLport/merge/test.cc =================================================================== --- trunk/complement/explore/inquiry/STLport/merge/test.cc (rev 0) +++ trunk/complement/explore/inquiry/STLport/merge/test.cc 2007-09-28 10:41:29 UTC (rev 1750) @@ -0,0 +1,30 @@ +#include <list> +#include <iostream> + +using namespace std; + +int main() +{ + // char buf1[1024]; + // StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1)); + + // char buf2[1024]; + // StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2)); + + // typedef list<int, StackAllocator<int> > ListInt; + typedef list<int> ListInt; + + ListInt lint1(10, 0 /* , stack1 */ ); + ListInt lint2(10, 1 /* , stack2 */ ); + + // ListInt lintref(stack2); + // lintref.insert(lintref.begin(), 10, 1); + // lintref.insert(lintref.begin(), 10, 0); + + lint1.merge(lint2); + cerr << lint1.size() << endl; + // CPPUNIT_ASSERT( lint1 == lintref ); + // CPPUNIT_ASSERT( lint2.empty() ); + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-10-24 16:52:50
|
Revision: 1773 http://complement.svn.sourceforge.net/complement/?rev=1773&view=rev Author: complement Date: 2007-10-24 09:52:49 -0700 (Wed, 24 Oct 2007) Log Message: ----------- istreambuf_iterator Added Paths: ----------- trunk/complement/explore/inquiry/STLport/istreambuf_iter/ trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile.inc trunk/complement/explore/inquiry/STLport/istreambuf_iter/test.cc Property changes on: trunk/complement/explore/inquiry/STLport/istreambuf_iter ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile =================================================================== --- trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile (rev 0) +++ trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile 2007-10-24 16:52:49 UTC (rev 1773) @@ -0,0 +1,14 @@ +# -*- Makefile -*- Time-stamp: <03/07/09 18:08:47 ptr> + +SRCROOT := ../../.. +# COMPILER_NAME := gcc + +STLPORT_DIR := /export/home/ptr/STLport.lab/STLport +include Makefile.inc +include ${SRCROOT}/Makefiles/gmake/top.mak + + +INCLUDES += -I$(SRCROOT)/include + +LDFLAGS += -Wl,-rpath=$(STLPORT_LIB_DIR) + Added: trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile.inc =================================================================== --- trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile.inc (rev 0) +++ trunk/complement/explore/inquiry/STLport/istreambuf_iter/Makefile.inc 2007-10-24 16:52:49 UTC (rev 1773) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <02/07/14 14:03:13 ptr> + +PRGNAME = test +SRC_CC = test.cc Added: trunk/complement/explore/inquiry/STLport/istreambuf_iter/test.cc =================================================================== --- trunk/complement/explore/inquiry/STLport/istreambuf_iter/test.cc (rev 0) +++ trunk/complement/explore/inquiry/STLport/istreambuf_iter/test.cc 2007-10-24 16:52:49 UTC (rev 1773) @@ -0,0 +1,52 @@ +#include <iostream> +// #include <fstream> +#include <string> +#include <vector> +#include <iterator> +#include <sstream> + +using namespace std; + +int main() +{ + // ifstream f; + stringstream s( "1234567890" ); + stringstream g( "1234567890xx" ); + char buf[] = "12345678901234"; + string line; + vector<char> v; + + // f.open( "test.txt", fstream::in ); + // v.assign( istreambuf_iterator<char>(f), istreambuf_iterator<char>() ); + + v.assign( istreambuf_iterator<char>(s), istreambuf_iterator<char>() ); + cerr << v.size() << endl; + + for ( vector<char>::const_iterator i = v.begin(); i != v.end(); ++i ) { + cerr << *i; + } + + cerr << endl; + + vector<char>::const_iterator j = v.begin() + 5; + + v.assign( istreambuf_iterator<char>(g), istreambuf_iterator<char>() ); + + j += 1; + + cerr << *j << endl; + + v.assign( buf, buf + 14); + + for ( vector<char>::const_iterator i = v.begin(); i != v.end(); ++i ) { + cerr << *i; + } + + cerr << endl; + + j += 1; + + cerr << *j << endl; + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |