[Issue 4126] std.range.ElementType doesn't work with opApply

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 18 18:00:17 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4126


David Simcha <dsimcha at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #2 from David Simcha <dsimcha at yahoo.com> 2010-08-18 18:00:10 PDT ---
I've added ForeachType to std.traits. 
(http://dsource.org/projects/phobos/changeset/1897)  I think this is a better
solution.  The only thing opApply and ranges have in common is the ability to
be iterated over using a foreach loop.  In some corner cases, such as when a
class/struct defines both opApply and range primitives, or when the type is a
narrow string, ElementType can be different from ForeachType.  If you want your
code to be agnostic of how the foreach loop is implemented and simply iterate
over the object with a foreach loop, then what you really care about is the
ForeachType, not the ElementType.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list