// 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; } }