assignment-operator
Passing temporaries as LValues
I\'d like to use the following idiom, that I think is non-standard. I have functions which return vectors taking advantage of Return Value Optimization:[详细]
2023-01-06 00:14 分类:问答assignment operator overloading problem
This issue has me confused.The first piece of code works fine without crashing, it assigns s1 to s2 perfectly fine.But the second group of code causes the program to crash.[详细]
2023-01-04 09:21 分类:问答Preventing copy construction and assignment of a return value reference
If I have a function that returns a reference to an instance of a class that I don\'t have control over its source, say list<int>:[详细]
2023-01-04 08:29 分类:问答In Objective C, is there a difference between if (object == nil) and if (nil == object)?
I would lean towards if (object == nil) but I\'ve noticed in some tutorials the use of if (nil == object)[详细]
2023-01-03 20:56 分类:问答Why would the assignment operator ever do something different than its matching constructor?
I was reading some boost co开发者_C百科de, and came across this: inline sparse_vector &assign_temporary(sparse_vector &v) {[详细]
2022-12-30 01:21 分类:问答Assigning a vector of one type to a vector of another type
I have an \"Event\" class. Due to the way dates are handled, we need to wrap this class in a \"UIEvent\" class, whi开发者_Python百科ch holds the Event, and the date of the Event in another format.[详细]
2022-12-27 07:20 分类:问答Has anyone found the need to declare the return parameter of a copy assignment operator const?
The copy assignment operator has the usual signature: my_class & operator = (my_class const & rhs);[详细]
2022-12-27 05:46 分类:问答C++ type-checking at compile-time
all. I\'m pretty new to C++, and I\'m writing a small library (mostly for my own 开发者_开发百科projects) in C++. In the process of designing a type hierarchy, I\'ve run into the problem of defining t[详细]
2022-12-26 05:43 分类:问答Shortcut "or-assignment" (|=) operator in Java
I have a long set of comparisons to do in Java, and I\'d like to know if one or more of them come out as true. The string of comparisons was long and difficult to read, so I broke it up for readabilit[详细]
2022-12-23 21:02 分类:问答C++ copy-construct construct-and-assign question
Here is an extract from item 56 of the book \"C++ Gotchas\": It\'s not uncommon to see a simple initialization of a Y object written[详细]
2022-12-23 19:00 分类:问答