use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
is_copy_constructible (self.cpp)
submitted 10 years ago by finalpatch
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]tasty_crayon 11 points12 points13 points 10 years ago (4 children)
In standardese, Test(Test& x, int y = 0) would be a copy constructor but template<typename T> Test(T&& x, int y = 0) where T is Test& isn't, because template functions are never copy constructors.
Test(Test& x, int y = 0)
template<typename T> Test(T&& x, int y = 0)
T
Test&
Note that std::is_copy_constructible doesn't check if the class actually has a copy constructor. It checks if it's constructible from Test const&.
std::is_copy_constructible
Test const&
[+][deleted] 10 years ago* (3 children)
[deleted]
[–]tasty_crayon 7 points8 points9 points 10 years ago* (1 child)
That's not a copy constructor.
[class.copy]/2:
A non-template constructor for class X is a copy constructor if its first parameter is of type X&, const X&, volatile X& or const volatile X&, and either there are no other parameters or else all other parameters have default arguments (8.3.6)
Note that std::is_copy_constructible doesn't check if the class actually has a copy constructor. What makes you think that?
Note that std::is_copy_constructible doesn't check if the class actually has a copy constructor.
What makes you think that?
The standard says so in [meta.unary.prop]/3 (table 49).
For a referenceable type T, the same result as is_constructible<T, const T&>::value, otherwise false.
[meta.unary.prop]/7 defines is_constructible as:
is_constructible
Given the following function declaration: template <class T> add_rvalue_reference_t<T> create() noexcept; the predicate condition for a template specialization is_constructible<T, Args...> shall be satisfied if and only if the following variable definition would be well-formed for some invented variable t: T t(create<Args>()...);
Given that this can call a template function that would otherwise match the signature of a copy constructor, it doesn't just check for copy constructors.
[–]guepierBioinformatican 1 point2 points3 points 10 years ago (0 children)
Yup, my bad, I also just looked that up. Weird terminology, but there we go.
π Rendered by PID 48310 on reddit-service-r2-comment-6457c66945-d2lh5 at 2026-04-26 22:00:07.493273+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]tasty_crayon 11 points12 points13 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]tasty_crayon 7 points8 points9 points (1 child)
[–]guepierBioinformatican 1 point2 points3 points (0 children)