Timeline for Creating URL with Builder pattern
Current License: CC BY-SA 3.0
        9 events
    
    | when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 4, 2018 at 3:41 | history | edited | Jerry Coffin | CC BY-SA 3.0 | 
                
                    added 369 characters in body 
                
             | 
| Apr 4, 2018 at 3:15 | comment | added | Jerry Coffin | @nullbyte: Use of overloaded operators kind of depends--in this case, we can use exactly the same characters here as we do in an actual URL, so they fit pretty easily. For the port and/or fragment, it may be open to more question, since we can't overload :or#. OTOH, something like/"www.foo.com" + fragment("bar")would probably be all right. Or you might want to add a user-defined literal operator, so you could use something like"bar"_fragment. Either could work (but neither is as obviously "right" as using/for composing a path). | |
| Apr 4, 2018 at 1:29 | comment | added | nullbyte | @Jerry Coffin, thanks! Also, is it preferable to use overloaded operators in C++ rather than fluent interfaces? Which is considered as the standard way of doing it? It looks nice with operators! In Java, we can't overload operators, so I'm just curious how professional developers do it in C++. | |
| Apr 4, 2018 at 0:42 | vote | accept | nullbyte | ||
| Apr 4, 2018 at 0:41 | comment | added | Jerry Coffin | @nullbyte: You could--in fact, I had it that way at one point, but decided it was worth a couple extra lines of code to be able to refer to the key and value as kandv(orkeyandvalue, if you prefer) instead offirstandsecond. | |
| Apr 4, 2018 at 0:29 | comment | added | nullbyte | @JerryCoffin Awesome! Thanks for the effort. Can we use std::pair<std::string, std::string>instead ofquery? | |
| Apr 3, 2018 at 14:11 | comment | added | Jerry Coffin | @Edward: Yes, and probably username and password, while we're at it. That's why I called this "minimalist"--enough to make the intent apparent, but definitely not even an attempt at a finished product. | |
| Apr 3, 2018 at 12:44 | comment | added | Edward | To be pedantic, and to follow RFC 3986, we could also add a fragmentclass. | |
| Apr 3, 2018 at 7:32 | history | answered | Jerry Coffin | CC BY-SA 3.0 |