From 361fcde22d3c9729882505968c3370effb0ac772 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 14 Mar 2019 22:03:59 +0300 Subject: Add support for c++ source file extensions granular customization --- bdep/new-types.ixx | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 bdep/new-types.ixx (limited to 'bdep/new-types.ixx') diff --git a/bdep/new-types.ixx b/bdep/new-types.ixx new file mode 100644 index 0000000..a8eafc5 --- /dev/null +++ b/bdep/new-types.ixx @@ -0,0 +1,64 @@ +// file : bdep/new-types.ixx -*- C++ -*- +// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include // move() + +namespace bdep +{ + template + inline cmd_new_lang_template:: + ~cmd_new_lang_template () + { + if (lang == c) + c_opt.~C (); + else + cxx_opt.~CXX (); + } + + template + inline cmd_new_lang_template:: + cmd_new_lang_template (cmd_new_lang_template&& l): lang (l.lang) + { + if (lang == c) + new (&c_opt) C (move (l.c_opt)); + else + new (&cxx_opt) CXX (move (l.cxx_opt)); + } + + template + inline cmd_new_lang_template:: + cmd_new_lang_template (const cmd_new_lang_template& l): lang (l.lang) + { + if (lang == c) + new (&c_opt) C (l.c_opt); + else + new (&cxx_opt) CXX (l.cxx_opt); + } + + template + inline cmd_new_lang_template& cmd_new_lang_template:: + operator= (cmd_new_lang_template&& l) + { + if (this != &l) + { + this->~cmd_new_lang_template (); + + // Assume noexcept move-construction. + // + new (this) cmd_new_lang_template (move (l)); + } + + return *this; + } + + template + inline cmd_new_lang_template& cmd_new_lang_template:: + operator= (const cmd_new_lang_template& l) + { + if (this != &l) + *this = cmd_new_lang_template (l); // Reduce to move-assignment. + + return *this; + } +} -- cgit v1.1