<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 30, 2017 at 11:34 PM, Nicolas Lesser via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">There's nothing inherently wrong with deleting member functions that are private, but if they are public, you will get a better error message (namely that the function is deleted) instead of an error message that says that the functions are private.<div dir="auto"><br></div><div dir="auto">AFAIK, Qt supports C++11, but also previous versions. I don't know how they implemented Q_DISABLE_COPY, but it probably expands to copy constructor and copy assignment declarations before C++11, and if you enable C++11 mode, deletes them instead. In pre-C++11, the declarations would have to be private, so you get an error at compile time and not at link time.</div><div dir="auto"><br></div><div dir="auto">If you're only compiling with C++11, it should be safe to put the macro in public. Alternately, you can always delete the copy constructor and assignment yourself.</div></div>
</blockquote></div><br></div><div class="gmail_extra">Another reason to prefer making these "public" is non-technical: they affect fundamental aspects of the client interface of a class, and hiding them in "private" as if they were implementation details is unhelpful.  Unfortunately necessary in C++98, but no longer needed with C++11.</div><div class="gmail_extra"><br></div><div class="gmail_extra">-- James</div><div class="gmail_extra"><br></div></div>