Why would a copy constructor have more than one parameter?

后端 未结 4 1017
闹比i
闹比i 2021-02-05 17:01

$12.8/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

4条回答
  •  别跟我提以往
    2021-02-05 17:23

    The BDE allocator [PDF Link] used this quirk. For example their array allocator looked like this:

    template 
    class bde::Array {
    public:
        Array(bde::Allocator *allocator = 0);
        Array(const Array &rhs, bde::Allocator *allocator = 0);
    };
    

提交回复
热议问题