initialization Questions
3
Solved
Since it's Thanksgiving today in the USA, I'll be the designated turkey to ask this question:
Take something as innocuous as this. An atomic with a simple plain old data type such as an int:
atom...
Amaral asked 29/11, 2019 at 5:54
9
Solved
I have 2 resource managing classes DeviceContext and OpenGLContext both are members of class DisplayOpenGL. The resource lifetimes are tied to DisplayOpenGL. Initialization looks like this (pseudo ...
Stratus asked 9/11, 2012 at 15:43
4
Solved
I have a constructor that takes some arguments. I had assumed that they were initialized in the order listed, but in one case, it appears they were being initialized in reverse, resulting in an abo...
Zahn asked 7/8, 2009 at 4:0
2
Solved
The only difference I can see between designated and convenience initialisers is that the former necessarily calls a super class init (if available).
I don't understand then why I can't add a desi...
Plasia asked 12/11, 2014 at 0:44
3
Solved
In a pub quiz by Dave Cheney I came across the following construct:
a := [...]int{5, 4: 1, 0, 2: 3, 2, 1: 4}
fmt.Println(a)
>> [5 4 3 2 1 0]
(Playground Link)
It seems you can use keys i...
Viewy asked 30/3, 2016 at 7:35
1
Solved
I'm failing to programmatically initialize a static constexpr std::array member.
This is a minimal example of my issue (for simplification size is known and small, thus initialization could be manu...
Affer asked 7/7, 2023 at 16:39
3
Solved
I'm cleaning up a python object class, focusing mainly on how the object is created. The __init__ method creates a an empty dictionary that needs to be filled almost instantly. But this should NOT ...
Zwickau asked 7/4, 2016 at 18:8
8
Solved
I want to handle stage events (i.e. hiding) from my controller class. So all I have to do is to add a listener like this:
((Stage) myPane.getScene().getWindow()).setOn*whatIwant*(...);
But the pro...
Hydromedusa asked 6/11, 2012 at 7:18
3
Solved
I want to be able to initialize a
CArticle having the following properties:
Private pNumber As String
Private pQuantity As Double
with either empty, pre-defined or current values. How can I ach...
Mesocarp asked 23/3, 2012 at 14:16
3
Solved
I have Rails 3
Carrierwave 0.5.4
//app/uploaders/fasta_uploader.rb
class FastaUploader < CarrierWave::Uploader::Base
storage :file
def store_dir
'public/data/01_fasta'
end
end
//migrati...
Kastroprauxel asked 6/7, 2011 at 19:21
11
Solved
I have a data structure like this:
struct foo {
int id;
int route;
int backup_route;
int current_route;
}
and a function called update() that is used to request changes in it.
update(42, dont...
Rodin asked 14/4, 2009 at 20:13
1
Running mamba inside conda base.
mamba installed via mambaforge but OUTSIDE conda base. (??)
python 3.10.8
From within conda base, running mamba init gives the following error:
`user@pop-os:~$ ma...
Sympathy asked 13/4, 2023 at 0:20
2
Solved
Suppose I have a class
class MyClass
int buf[10];
public:
MyClass(int i) {
new (&buf) OtherClass(i); // How to move this to constructor initialize list?
}
Simply copy that line to the place...
Trypanosomiasis asked 10/5, 2017 at 1:42
3
Solved
I have this code
#enable nullable
public class SomeClass
{
public string SomeProperty { get; init; }
}
With the following compiler warning:
[CS8618] Non-nullable property 'SomeProperty' must con...
Primrose asked 18/12, 2021 at 11:10
4
Suppose I have the following:
#include <memory>
struct A { int x; };
class B {
B(int x, std::unique_ptr<A> a);
};
class C : public B {
C(std::unique_ptr<A> a) : B(a->x, st...
Batch asked 17/7, 2014 at 22:41
2
Solved
When I tried to do:
d = {1:2, 3:10, 6:300, 2:1, 4:5}
I get the error:
syntax: { } vector syntax is discontinued
How to initialize a dictionary in Julia?
Bryanbryana asked 7/2, 2017 at 9:50
5
Solved
I'm using React hooks for app state, I wondered about how to initialize the function component state using props? The useState hook doc says something definitive like,
const [count, setCount] = use...
Emaciated asked 11/12, 2019 at 15:53
8
Solved
If 'Test' is an ordinary class, is there any difference between:
Test* test = new Test;
and
Test* test = new Test();
Heliochrome asked 6/3, 2009 at 19:39
2
Solved
Consider the following code:
#include <utility>
#include <vector>
using V = std::vector<int>;
int main() {
std::pair<int, V> p1{1, 2}; // p1.second has 2 elements
std::p...
Wilcox asked 15/3, 2023 at 14:54
5
Solved
In C++11, one can use initializer lists to initialize parameters in functions. What is the purpose of it? Can't the same be done with const vectors? What is the difference of the two programs below...
Crosley asked 3/1, 2015 at 9:30
4
Solved
I have this piece of code that loads Properties from a file:
class Config {
val properties: Properties = {
val p = new Properties()
p.load(Thread.currentThread().getContextClassLoader.getResou...
Spoilsman asked 28/1, 2013 at 17:50
2
I want to create vector-table to create start-up code for MCU
when I try to put function address in to the vector-table the compiler produces an error: initialiser element is not constant
void rese...
Dalliance asked 21/2, 2023 at 18:19
4
Solved
I have seen the weights of neural networks initialized to random numbers so I am curious why the weights of logistic regression get initialized to zeros?
Floorer asked 10/9, 2017 at 14:58
8
I am new to Swift and would like to initialize an object's member variable using an instance method like this:
class MyClass {
var x: String
var y: String
func createY() -> String {
self.y...
Slantwise asked 21/2, 2015 at 14:21
3
Solved
I come from a MATLAB background. When I create class definitions, I can instantiate "empty" variable names and then later assign values or objects to them. I.e.
classdef myclass < handle
p...
Zouave asked 17/7, 2015 at 1:35
© 2022 - 2024 — McMap. All rights reserved.