Questions tagged [delete-keyword]

8 questions
7
votes
1 answer

Statically delete object key JavaScript

I'm using TypeScript along with TSLint, and I have the following code: var myObj = {} var id = "key" myObj[id] = 1 delete myObj[id] But I receive a hint from TSLint: Do not delete dynamically computed property keys. (no-dynamic-delete) The…
Ari Seyhun
  • 11,506
  • 16
  • 62
  • 109
4
votes
3 answers

In new c++11 projects, should I delete any operations by default?

I am starting a new project in C++11, and just found out about the delete keyword that lets you prevent accidental calling of copy constructors and so on. Is there a "recommended" set of deletions I can do globally to increase type safety, such as…
Drew
  • 12,578
  • 11
  • 58
  • 98
2
votes
0 answers

Does it makes sense to specify noexcept on deleted operator?

Does it makes sense to specify noexcept on, for example. a deleted move assignment operator? For example: struct A { A& operator=( A&& ) noexcept = delete; }; What would change if I do not specify it, and I just write: struct A { A&…
nyarlathotep108
  • 5,275
  • 2
  • 26
  • 64
1
vote
0 answers

How to reset js window objects on a condition

Am using nested if to iterate through a list of window attributes and am deleting the window attribute based on a criteria. Since this s a nested loop, the execution time takes .5seconds. We have to make it quicker and bring it down to millisecs.…
Steffie
  • 11
  • 2
1
vote
1 answer

Check whether a default-deleted function template is explicitly specialized for a specific type?

(This question has been significantly edited, sorry.) Suppose I have several non-constexpr function templates, which default to being deleted: template void foo() = delete; template int bar(int x) = delete; // etc. and…
1
vote
1 answer

How does delete-keyword work inside this for-each loop?

I am new to C++ and I'm trying to understand how this piece of code works. ~List() { for(auto& i : nodes) { delete &i; } } I have made a Simple Linked List class that has a vector of nodes. What I am trying to understand is, if I…
Saumi
  • 67
  • 3
1
vote
1 answer

Delete key failed. gpg: WARNING: unsafe ownership on homedir `/xxx/xxx_Import_tools/Keys'

The former xxx.BrokerImport is expired, and I generate a new key with the same name 'xxx.Import' and import it into remote server. But I can't delete the former one. They have same name, when I use 'xxx.Import' to encrypt, it will failed, I guess it…
Destiny
  • 21
  • 2
0
votes
0 answers

Can the "delete" keyword be used for virtual functions?

Consider the following scenario: Class A defines many virtual functions. Class B and class C inherit from class A, but I want some virtual functions in class A to be available only in class B and not in class C. I wrote the following code to try it…
lin
  • 1
  • 1