参数可能是rc cell ...
解决了;
#define let auto
#define $new(class,...)   std::make_unique<class>(__VA_ARGS__)
#define $share(class,...) std::make_shared<class>( __VA_ARGS__)
class A{
public:
	string name;
	string age;
	A(){}
	A(string name, string age= "sdsd"):name(std::move(name)), age(std::move(age)){
	}
	template<typename A, typename B>
	void some(A &a, B &b){
		this->name  = a->name + b->name;
	}
};
int main(){
	let a = $new(A, "dsdf");
	let b = $new(A, "sdfsdf");
	let c = $new(A, "sdfsdf");
	let d = $share(A, "sdf");
        a->some(d, c);
	a->some(b, d);
	$ a->name;
}
	    
	    
		1
	    
	    
	    共 3 条评论, 1 页
	
	
    
评论区
写评论好家伙,点进来看了半天发现是c++
你这个代码改成rust把some改成泛型函数不就行了... 约束怎么写查下标准库就有
我也不会
但似乎应该试试
derive