#include <iostream>
using namespace std;
template<typename _VType, size_t _Len>
class Obc {
private:
const size_t len = _Len;
_VType m[_Len]; // attention: fixed size used for demo
public:
Obc() {}
Obc(_VType *values) {
for (int i=0; i<_Len; i++)
m[i]=values[i];
}
void show() const {
cout<<"Object with len "<<_Len<<" = [ ";
for (int i=0; i<_Len; i++)
cout << m[i] <<" ";
cout<<"]"<<endl;
}
};
using _DType = int;
int main() {
_DType values[]={ 1,2,3};
Obc<_DType, 2> m;
m.show();
Obc<_DType, 2> mat{values}; // assuming _DType *values point to something
mat.show();
auto othermat = mat;
othermat.show();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdGVtcGxhdGU8dHlwZW5hbWUgX1ZUeXBlLCBzaXplX3QgX0xlbj4KY2xhc3MgT2JjIHsKICBwcml2YXRlOgogICAgY29uc3Qgc2l6ZV90IGxlbiA9IF9MZW47CiAgICBfVlR5cGUgbVtfTGVuXTsgICAgIC8vIGF0dGVudGlvbjogZml4ZWQgc2l6ZSB1c2VkIGZvciBkZW1vIAogIHB1YmxpYzoKICAgIE9iYygpIHt9CiAgICBPYmMoX1ZUeXBlICp2YWx1ZXMpIHsgCiAgICAgICAgIGZvciAoaW50IGk9MDsgaTxfTGVuOyBpKyspCiAgICAgICAgICAgICBtW2ldPXZhbHVlc1tpXTsKICAgIH0KICAgIHZvaWQgc2hvdygpIGNvbnN0IHsKICAgICAgICAgIGNvdXQ8PCJPYmplY3Qgd2l0aCBsZW4gIjw8X0xlbjw8IiA9IFsgIjsgCiAgICAgICAgICBmb3IgKGludCBpPTA7IGk8X0xlbjsgaSsrKQogICAgICAgICAgICAgY291dCA8PCBtW2ldIDw8IiAiOwogICAgICAgICAgY291dDw8Il0iPDxlbmRsOwogICAKICAgIH0KfTsKCnVzaW5nIF9EVHlwZSA9IGludDsKCmludCBtYWluKCkgewoJX0RUeXBlIHZhbHVlc1tdPXsgMSwyLDN9OwoJT2JjPF9EVHlwZSwgMj4gbTsKCW0uc2hvdygpOyAKCU9iYzxfRFR5cGUsIDI+IG1hdHt2YWx1ZXN9OyAgICAvLyBhc3N1bWluZyBfRFR5cGUgKnZhbHVlcyBwb2ludCB0byBzb21ldGhpbmcKCW1hdC5zaG93KCk7CglhdXRvIG90aGVybWF0ID0gbWF0OwoJb3RoZXJtYXQuc2hvdygpOwoJcmV0dXJuIDA7Cn0=