I have a list<Myobj> source which contains some Myobj instances, if I assign it to an empty list<MyObj> target what exactly happens in terms of contents?
Are Myobj instances duplicated in target via shallow copy? is the copy contructor called? or are they not duplicated at all?
All the objects in the first list are copied into the second list. It is better not to think about “shallow” and “deep” copying here. The elements are copied, and the “depth” of the copy depends on what the class’ copy constructor or assignment operator do. If your type T were a plain pointer, then the pointers would get copied, but not what they point to. There is no special magic going on.
Note that there are some subtleties which depend on what the source, or RHS of the assignment is (thanks to @mooingduck for reminding me of this). In C++11, there are situations in which the contents of the RHS could be moved into the LHS, in which case there is no copying at all.