21,157 questions
Score of 4
2 answers
187 views
How to change $_ value before condition check
I have an $ADusers variable which is array of AD user objects. Also I have variable $mb which is MS Exchange mailbox object.
I need to select an user object from $ADusers array that corresponds to ...
Best practices
0
votes
8
replies
254
views
Is fixing child.prototype.constructor necessary in ES5 if we solely rely on [[Prototype]] check methods like Object.getPrototypeOf()?
When implementing the parasitic combination inheritance pattern in ES5, almost every resource (including Nicholas Zakas' book) insists on fixing the constructor property like this:
function ...
Score of -3
1 answer
113 views
In JS how do I make parent properties update when I create new child objects? [closed]
Maybe I am doing most of the stuff right already.
Am I making the house objects part of a parent the right way? With my newHouse() function in the Street class? Are there other ways, like in the House ...
Score of 1
3 answers
232 views
no match for call to '(student) (std::string&, int&, int&)'
I'm trying to create an array of class student that I initialize later:
#include <iostream>
#include <string>
using namespace std;
class student{
private:
string name;
...
Score of 5
1 answer
344 views
What is the purpose of std::type_identity in std::vector's constructors?
I think I understand the purpose of std::type_identity_t, that it's supposed to help in the scenario where type deduction of a template does not require all template arguments to determine the ...
Score of 1
1 answer
150 views
Create a custom cast (that also accepts $null)
(Continuing from: Cast to custom class in PowerShell) I would like to build a custom cast like:
class CheckBox {
[Nullable[Bool]]$NullableBool
CheckBox([Nullable[Bool]]$NullableBool) { $this....
Score of 24
1 answer
1575 views
Heisenbug where static_assert is satisfied but triggers other static_assert
I have pinned a strange compilation error to this minimal code example:
#include <iterator>
#include <type_traits>
struct A {
class iterator {
private:
int i = 0; // compiles if &...
Score of -3
1 answer
351 views
How do you make a default constructor and fix the type deduction error indicated by E3158 and E0289?
I am making several template classes and their non-initialized declarations give errors E3158 and E0289, indicating that my compiler cannot identify the class's template arguments.
What is a way ...
Score of 2
0 answers
91 views
R6 object aware of its constructor
I was wondering if it's possible to get the object constructor from within an R6 object. One obvious way would be something like this:
test <- R6::R6Class('test',
public = ...
Best practices
0
votes
8
replies
60
views
Initialize a Typescript class property once
Let's say I have a class with many parameters. In Typescript, this is how the class is created:
class ClassName {
private para1: string
para2: boolean
para3: number = 6
protected ...
Score of 3
1 answer
126 views
Powershell Class generic interface arguments type resolution problem
Can't seems to find why generic interface types are allowed in powershell class argument attributes, but they can't accept anything - powershell class type resolution doesn't work in this case. Is ...
Score of 1
2 answers
111 views
JavaScript: How many objects are allocated when returning an object literal from a class constructor?
Let's say I have this code:
class MyClass {
constructor() {
return {};
}
}
const x = new MyClass(); // how many objects are instantiated with this?
I know that variable x just holds ...
Score of 0
0 answers
137 views
What makes QGuiApplication construction hang in this case?
Here's a piece of Qt code:
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QGuiApplication app2(argc, argv);
The first constructor call returns, the second does not.
I ...
Score of -5
3 answers
246 views
std::shared_ptr const vs non-const, instance vs reference in constructor
Consider passing a shared pointer of const std::shared_ptr<Object> to the ctor of following class.
struct MyClass {
explicit MyCLass(const std::shared_ptr<const Object> & input) : ...
Score of 2
2 answers
161 views
Subtlety in initializing attributes with methods in modules from the `equinox` `jax` library
I have the following code that defines an abstract class and its final subclasse. The two classes are both subclasses of the equinox.Module class, which registers class attributes as the leaves of a ...