Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBrother Bob

Posted 15 October 2012 - 12:36 PM

Use a smart pointer class instead and let the compiler do all that job for you.
struct some_class {
	some_class(int some_val) :
	    ptr1(new int(some_val)),
	    ptr2(new int(some_val)),
	    ptr3(new int(some_val)),
	    ptr4(new int(some_val))
    { }

	std::unique_ptr<int> ptr1, ptr2, ptr3, ptr4;
};

#1Brother Bob

Posted 15 October 2012 - 12:35 PM

Use a smart pointer class instead and let the compiler do all that job for you.
struct some_class {
    some_class(int some_val) : ptr1(new int(some_val)), ptr2(new int(some_val)), ptr3(new int(some_val)), ptr4(new int(some_val)) {}

    std::unique_ptr<int> ptr1, ptr2, ptr3, ptr4;
};

PARTNERS