default

Explicitly defaulted destructor disables default move constructor in a class

可紊 提交于 2021-02-05 07:10:29
问题 I have run into a problem that a move constructor of a superclass did not get invoked properly when its subclass has an explicitly defaulted destructor. The move constructor does get invoked when the destructor is implicitly defaulted (not provided at all in the supclass definition). I am aware of the constraints that the compilers should apply to default move constructors. Yet, I have been by all means sure that the compiler should not discriminate between explicitly/implicitly defaulted

C# SQL Server backup of a remote database to the remote default backup location without direct access to the remote location?

限于喜欢 提交于 2021-01-29 17:20:38
问题 TL;DR - I want the server to take a backup not my application because the server is set up to do so and my application won't have access. Background My company created software for clients 20 years ago written in Delphi 7/Pascal. I am re-writing the software in C#. As part of the re-write I have created new Firebird, Oracle, and SQL Server databases. Federal regulation requires that all of the existing data is maintained so I have created a database modification / transformation tool in order

MySQL - set dynamic default value [duplicate]

本小妞迷上赌 提交于 2021-01-29 07:23:33
问题 This question already has answers here : MySQL default value as other field's value (2 answers) Closed 2 years ago . I have table of users in my MySQL database. Is it possible to set default value of column profile_url to value of column Id ? 回答1: You could use trigger to implement the feature. For example: CREATE TRIGGER defaultUrl BEFORE INSERT ON MyTable FOR EACH ROW SET NEW.profile_url = IFNULL(NEW.profile_url, NEW.id); The expression creates a trigger named defaultUrl that activates

setting default values for empty nodes

泄露秘密 提交于 2021-01-28 10:22:42
问题 I need to transform a piece of XML, so that the value of every node in a list I specify is set to "0" for example: <contract> <customerName>foo</customerName> <contractID /> <customerID>912</customerID> <countryCode/> <cityCode>7823</cityCode> </contract> would be transformed into <contract> <customerName>foo</customerName> <contractID>0</contractID> <customerID>912</customerID> <countryCode>0</contractID> <cityCode>7823</cityCode> </contract> How can this be accomplished using XSLT? I have

How to declare the default indexed property in C++/CLI interface

浪子不回头ぞ 提交于 2021-01-27 20:31:01
问题 how is it possible to declare the default indexed property in an C++/CLI - Interface. (Please excuse the repeating, full qualified notation with namespaces because I'm just learning C++/CLI and want to be sure that no acciential mixup of language primitives between C++ and C# happens) Code is public interface class ITestWithIndexer { property System::String ^ default[System::Int32]; } Compiler always throws "error C3289: 'default' a trivial property cannot be indexed". Where is my error? PS:

Default or zero value of unknown template type

青春壹個敷衍的年華 提交于 2021-01-27 05:12:33
问题 Assuming the template function template<typename T> T foo(){ // ... // Error occured if(error) return 0; // ... } which should return 0 , 0.0f , nullptr , ... depending on the type T , when an error occured. How to get the 0 of a unknown template type? in C# you can write default(T) to do this. How to perform this in C++? 回答1: You can use value initialization like return T(); or return T{}; (since C++11), or just return {}; (see list initialization (since C++11)) to return the default value

Default or zero value of unknown template type

烂漫一生 提交于 2021-01-27 05:12:11
问题 Assuming the template function template<typename T> T foo(){ // ... // Error occured if(error) return 0; // ... } which should return 0 , 0.0f , nullptr , ... depending on the type T , when an error occured. How to get the 0 of a unknown template type? in C# you can write default(T) to do this. How to perform this in C++? 回答1: You can use value initialization like return T(); or return T{}; (since C++11), or just return {}; (see list initialization (since C++11)) to return the default value

How has += operator been implemented in c++?

早过忘川 提交于 2020-12-12 05:36:33
问题 This is a question I've always pondered on and have never found any resource stating the answer to this question. In fact its not only for += , but also for its siblings i.e. -= , *= , /= , etc. (of course not == ). Consider the example, int a = 5; a += 4; //this will make 'a' 9 Now consider the equivalent expression: a = a + 4; //This also makes 'a' 9 If += were simply a shorthand for a = a + <rhs of +=> overloading + operator should also implicitly overload += , unless explicitly overloaded