C++: converting a container to a container of different yet compatible type

后端 未结 8 977
南笙
南笙 2021-01-05 08:28

It often happens to me to have a a container C (or whatever kind of wrapper class, even smart pointers) for a type T1, and want to convert such

8条回答
  •  情歌与酒
    2021-01-05 09:09

    This is generally difficult. The problem becomes apparent when considering template specialization, for instance the infamous vector, which has an implementation that differs from a vector in much more than just the argument type.

提交回复
热议问题