I often use the following syntax:
std::vector<foo> vec; vec.push_back( someClass.getFoo(...).modifyAndReturn() );
Considered about exception safety, I quote the standard on vector's push back behavior (188.8.131.52):
If an exception is thrown other than by the copy constructor, move constructor, assignment operator, or move assignment operator of T or by any InputIterator operation there are no effects. If an exception is thrown by the move constructor of a non-CopyInsertable T, the effects are unspecified.
- Is it a good practice to use complicated push backs?
- Are there any perils exception wise?