cpp-httplib
                                
                                 cpp-httplib copied to clipboard
                                
                                    cpp-httplib copied to clipboard
                            
                            
                            
                        Reduce object copy further
I found more object copies that are not detected by static analyzers after submitting #1767
@jimmy-park thanks for the further modification. But I have actually been thinking of removing the changes of using std::move unless they are absolutely necessary, since it degrades code readability in my opinion and there are some cases that I don't think we should use std::move.
For instance, I found the following code recently, and it looks dangerous because pop_front() now accesses the moved object.
https://github.com/yhirose/cpp-httplib/blob/5c00bbf36ba8ff47b4fb97712fc38cb2884e5b98/httplib.h#L722-L723
Another example is the following.
https://github.com/yhirose/cpp-httplib/blob/5c00bbf36ba8ff47b4fb97712fc38cb2884e5b98/httplib.h#L3802 https://github.com/yhirose/cpp-httplib/blob/5c00bbf36ba8ff47b4fb97712fc38cb2884e5b98/httplib.h#L3839-L3842 https://github.com/yhirose/cpp-httplib/blob/5c00bbf36ba8ff47b4fb97712fc38cb2884e5b98/httplib.h#L3940-L3943
parse_header now passes moved objects to a functor, and a user who supplies a functor needs to know parameters need to be received as &&. I would like to avoid such a hidden dependency that makes the code harder to understand.
Also I simply prefer not seeing std::move too many places in httplib.h. They may give us performance benefit though, I think it's not a big performance gain or it's even unnoticeable. I am now more concerned with the code readability as the httplib.h grows, and would like to keep the code simpler. Also any performance improvements should be measured to see if they are really necessary.
I'll keep this pull request open for now, but I may close it later because of the above reason. Thanks for your understanding in this matter.