简体   繁体   中英

C++ template class constructor

I have a class:

template<typename T, typename S>
class filterable_data
{
    /* ... */
};

I create those two instances:

filterable_data<int, char> a;
filterable_data<int, bool> b = a;

My question is, how can I write that constructor properly?

By making it a template too:

template<typename T2, typename S2>
filterable_data(const filterable_data<T2, S2>& other);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM