www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11340] New: ElementType and ElementEncodingType return odd qualified element types

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

           Summary: ElementType and ElementEncodingType return odd
                    qualified element types
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-10-24
04:41:51 PDT ---
-----
import std.range;

void main()
{
    pragma(msg, ElementType!(string));   // dchar
    pragma(msg, ElementType!(wstring));  // dchar
    pragma(msg, ElementType!(dstring));  // immutable(dchar)

    pragma(msg, ElementEncodingType!(string));   // immutable(char)
    pragma(msg, ElementEncodingType!(wstring));  // immutable(wchar)
    pragma(msg, ElementEncodingType!(dstring));  // immutable(dchar)
}
-----

As far as I know these should all be const(T). Am I wrong?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 24 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11340


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-10-24
07:40:12 PDT ---
As commented here:
https://github.com/D-Programming-Language/phobos/pull/1660#discussion_r7189412

 dstring is a non-narrows string. Because of this, calling front gives you an 
 lvalue of the actual elements, as opposed to narrows strings, which give you 
 decoded dchar: They're mutable, but rvalues.
-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 24 2013