The Artima Developer Community
Sponsored Link

Weblogs Forum
Introducing the Iterable Concept

16 replies on 2 pages. Most recent reply: Nov 14, 2005 12:01 AM by Christopher Diggins

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 16 replies on 2 pages [ « | 1 2 ]
MB 2sync

Posts: 3
Nickname: mb2sync
Registered: Nov, 2005

Iterable is alive Posted: Nov 11, 2005 12:48 AM
Reply to this message Reply
Advertisement
Win32 has an API ::EnumChildWindows.
It is a model of "Iterable".

::EnumChildWindows should have been defined as
"Single Pass Range", but Win32 didn't know the concept and
cannot even stop the iteration.
So we cannot write a wrapper Range for ::EnumChildWindows
without additional resources like std::set<HWND>.

I always defined "for_each_toplevel_window" or something using ::EnumChildWindows.
If using "Iterable", it could be

toplevel_windows.for_each(functor);

or, (C++ style)

for_each(toplevel_windows, functor);

On the other hand, an API ::FindFirstFile can conform to "Single Pass Range",
because it returns a handle as "iterator".
See: http://www.codeproject.com/useritems/find_file.asp

I think that "Iterable" has less abstraction, but has more "power" than
Container or Range, because "Iterable" can iterate over a range that is difficult to
represent by two iterators.

Regards,
MB

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: Introducing the Iterable Concept Posted: Nov 14, 2005 12:01 AM
Reply to this message Reply
In response to the suggestions by Terje, I have created a downloadable demo of the Iterator concept with library support at http://www.ootl.org . I now also have some documentation at http://www.ootl.org/doc/ .

There is a new blog entry for the latest release at http://www.artima.com/weblogs/viewpost.jsp?thread=136559 which summarizes the documentation, and provides some code snippets.

Flat View: This topic has 16 replies on 2 pages [ « | 1  2 ]
Topic: No way to run a judicial system... Previous Topic   Next Topic Topic: Trees and Labelled S-Expressions


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us