www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3892] New: Built-in "set" type similar to associative arrays

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3892

           Summary: Built-in "set" type similar to associative arrays
           Product: D
           Version: 2.030
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: Justin.SpahrSummers gmail.com


--- Comment #0 from Justin Spahr-Summers <Justin.SpahrSummers gmail.com>
2010-03-08 03:03:42 CST ---
It's rather low priority, but it'd be nice to have built-in set functionality
(here meaning an unordered data structure where no duplicate values can exist).
Associative arrays can already fill the role to some extent if you just opt not
to use the values at all, but that's a waste of storage.

Syntax could even be similar, using "void" in place of a value type:

---
void main () {
    void[string] set;

    set.add("hello");
    assert("hello" in set);

    set.add("hello");
    set.remove("hello");
    assert(!("hello" in set));
}
---

If creating a new property ("add") is out of the question, even something
like...
    set["hello"] = true;
could work.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3892


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |DUPLICATE


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-05-22 07:06:43 PDT ---
*** This issue has been marked as a duplicate of issue 1606 ***

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