Boost C++ Libraries: Ticket #61: regex iterator requirement https://svn.boost.org/trac10/ticket/61 <pre class="wiki">regex require that iterator (eg for regex_match) has default constructor. AFAIK it's not a requirement for any (neither bidirectional) iterator to has a default constructor. eg for user defined iterator sometime it's a preformance decrease for iterator. eg. I'd like to use regex to search a file. if the file fit into the memory I use wstring's iterator, but if not I have to create an own bi_istream_iterator (since std::istream_iterator is not bidirectional:-(). after that I made an iterator which encapsulate these two iterator, but this hasn't deafult constructor and if I have to make a default one, than I'have to redesign it and add another bool member. what I realy wan't that the encapsulator iterator be as samll as possible, but it's getting harder and harder:-((( IMHO it's a bug in regex implementation. yours. </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/61 Trac 1.4.3 John Maddock Thu, 14 Feb 2002 11:54:48 GMT <link>https://svn.boost.org/trac10/ticket/61#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/61#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=14804 The standard requires all ForwardIterators and above to have a default constructor (see C++ standard, Table 74), sorry. WRT your particular problem - have a look at the mapfile class in boost/regex/detail/fileiter.cpp - this will either use a memory mapped file (on win32), or else use smart iterators to load sections of a file into memory as required - it may be close enough to what you need, or at least give you some ideas. regards, John Maddock. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>lfarkas</dc:creator> <pubDate>Fri, 15 Feb 2002 11:26:53 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/61#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/61#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=405207 thanks for the tipp again, but another bugreport in: boost/regex/detail/fileiter.cpp (which would be usefult to make public anyway) in mapfile (for win32) the following member should have to be const: ----------------------------------- const char* begin(){ return _first; } const char* end(){ return _last; } size_t size(){ return _last - _first; } bool valid(){ return (hfile != 0) &amp;&amp; (hfile != INVALID_HANDLE_VALUE); } ----------------------------------- the correct form: ----------------------------------- const char* begin() const { return _first; } const char* end() const { return _last; } size_t size() const { return _last - _first; } bool valid() const { return (hfile != 0) &amp;&amp; (hfile != INVALID_HANDLE_VALUE); } ----------------------------------- and if I send it to you another cosmetic fix. I always prefere member initilaization over assigment: ----------------------------------- mapfile(){ hfile = hmap = 0; _first = _last = 0; } mapfile(const char* file){ hfile = hmap = 0; _first = _last = 0; open(file); } ----------------------------------- my prefered version: ----------------------------------- mapfile() : hfile(0), hmap(0), _first(0), _last(0) {} mapfile(const char* file) : hfile(0), hmap(0), _first(0), _last(0) { open(file); } ----------------------------------- and for the unix version: ----------------------------------- mapfile(){ hfile = 0; _size = 0; _first = _last = 0; } mapfile(const char* file){ hfile = 0; _size = 0; _first = _last = 0; open(file); } ----------------------------------- the new ones; ----------------------------------- mapfile() : hfile(0), _size(0), _first(0), _last(0) {} mapfile(const char* file) : hfile(0), _size(0), _first(0), _last(0) { open(file); } ----------------------------------- yours. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 30 May 2003 11:06:23 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/61#comment:3 https://svn.boost.org/trac10/ticket/61#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket