[{"id":349,"web_url":"https://patchwork.libcamera.org/comment/349/","msgid":"<20190115224202.GK7393@bigcity.dyn.berto.se>","date":"2019-01-15T22:42:02","subject":"Re: [libcamera-devel] [PATCH v2 7/8] libcamera: utils: Implement\n\tC++14 make_unique<>()","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-01-15 17:18:48 +0200, Laurent Pinchart wrote:\n> C++14 introduces std::make_unique<>() that makes it easier to initialize\n> unique_ptr<> instances. As libcamera is limited to C++11, implement our\n> own version of the function in the libcamera::utils namespace.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  src/libcamera/include/utils.h | 13 +++++++++++++\n>  1 file changed, 13 insertions(+)\n> \n> diff --git a/src/libcamera/include/utils.h b/src/libcamera/include/utils.h\n> index 3ffa6f4ea591..a2e450b35372 100644\n> --- a/src/libcamera/include/utils.h\n> +++ b/src/libcamera/include/utils.h\n> @@ -7,6 +7,19 @@\n>  #ifndef __LIBCAMERA_UTILS_H__\n>  #define __LIBCAMERA_UTILS_H__\n>  \n> +#include <memory>\n> +\n>  #define ARRAY_SIZE(a)\t(sizeof(a) / sizeof(a[0]))\n>  \n> +namespace libcamera::utils {\n> +\n> +/* C++11 doesn't provide std::make_unique */\n> +template<typename T, typename... Args>\n> +std::unique_ptr<T> make_unique(Args&&... args)\n> +{\n> +\treturn std::unique_ptr<T>(new T(std::forward<Args>(args)...));\n> +}\n> +\n> +} /* namespace libcamera::utils */\n> +\n>  #endif /* __LIBCAMERA_UTILS_H__ */\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x242.google.com (mail-lj1-x242.google.com\n\t[IPv6:2a00:1450:4864:20::242])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C9A7A60C6A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 23:42:04 +0100 (CET)","by mail-lj1-x242.google.com with SMTP id v1-v6so3828507ljd.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 15 Jan 2019 14:42:04 -0800 (PST)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\tq67sm864691lfe.19.2019.01.15.14.42.03\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tTue, 15 Jan 2019 14:42:03 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=lSmVhQUijuAIFKw+2C4qdIIB5a8im0u5W3SKXPZEQIg=;\n\tb=BXPttRLlyPuEE/ve+rEjNEgOSzYNC9/encZnnCIR0VJshsdKu3qaIPDj9LgyVuVRrN\n\tvBsnj4wdwgRmrWny8bgCAA7ntaqaKHRhmSpawskjaJaq72U9uGCi0KsM51xJ1rPlNLFI\n\tGYWJbmRuLsUkfnL4jTEBm1rZjAFqjXK4u7PhPY3GTVguWqX3YRzbQcZBL4qzSDC6Ddrd\n\tNSR09vidjqBcgUdc5MfQm2bUZiOKQ+e34pYqyfU/ThseCBGnU9EF2vMB0MdzWAGB2LTN\n\tC+ooOULVUCN2Mxl17xA4k+ul3ZyEZWJcN8CrFKbCgo5VfGKZmyn29c2ZZL/iKBe3jouA\n\tb/cA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=lSmVhQUijuAIFKw+2C4qdIIB5a8im0u5W3SKXPZEQIg=;\n\tb=FJaoXwaVxCoffiu4rG8NGhpvSSK4uzBLhNdU8m+R61wJROEBSh4YxQ0CnMqyeJSh45\n\teiVloE52MdgjnhpOGlr6wrCg/TfPDuWq8Br0bWTwJoMXxBUdBjVvHwvSOEaaoV7uQLFh\n\tiyavAHDLpteKnvps1fcMNBRaMVYyPGO2HmvF1ju3dtD0/ZV9DipIL0dHgs4xmJR81sYU\n\tGaEbcSzVhmVstPSDVPPBE/cSpfpGFYIiuRzDrHLN2UoYvf7fNZRj6tZDLpWNoJy5wsfk\n\tR1YJPUtyMzkbUS9A64ztwgtxnDpSHCUQktiBP3vqdNM6UT0iSxx5DfS3IB8KaNfZj3jd\n\to5aQ==","X-Gm-Message-State":"AJcUukexmjYtR773phxMw5otFEs/I+qhq9+Cu1NqV2wFuQflVsVkPrtC\n\tPumZbgEjzkkkmm6bSVH96mQWJnEfjNA=","X-Google-Smtp-Source":"ALg8bN7S+h1MX5lr2Q3WfT09zuh7ai4FYVITHDnLDDl6uDnKzf9AkxwGogmXBbEZyyDLCZjxu5D2gQ==","X-Received":"by 2002:a2e:4601:: with SMTP id\n\tt1-v6mr4548639lja.111.1547592124096; \n\tTue, 15 Jan 2019 14:42:04 -0800 (PST)","Date":"Tue, 15 Jan 2019 23:42:02 +0100","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190115224202.GK7393@bigcity.dyn.berto.se>","References":"<20190115151849.1547-1-laurent.pinchart@ideasonboard.com>\n\t<20190115151849.1547-8-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190115151849.1547-8-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2 7/8] libcamera: utils: Implement\n\tC++14 make_unique<>()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 15 Jan 2019 22:42:05 -0000"}}]