View Single Post
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-10-2017 , 04:18   Re: How to copy ke::HashMap?
Reply With Quote #3

Thanks! Copy constructors were omitted from AMTL by design, but there's a PR for move constructors which would probably solve my issues. Unfortunately it has errors.

The issue I have with writing my own copy constructor is that its parameter is const, but ke::HashMap doesn't have a const iterator:
PHP Code:
    HTTPResponse(const struct HTTPResponse &other)
    {
        for (
HTTPHeaderMap::iterator iter other.headers.iter(); !iter.empty(); iter.next()) // member function 'iter' not viable: 'this' argument has type 'const HTTPHeaderMap' (aka 'const StringHashMap<ke::AString>'), but function is not marked const
        
{
            
headers.replace(iter->key.chars(), ke::Move(iter->value));
        }
    } 
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 07-10-2017 at 04:19.
DJ Tsunami is offline