initializer Questions
2
Solved
To my knowledge a reference cannot be null, but when I run code like this:
#include <iostream>
#include <string>
void test(int i, const std::string& s = nullptr) {
std::cout <...
Malapropism asked 6/5, 2019 at 8:22
2
Solved
Create a Triangle class with properties to store the length of each side. Triangles are called scalene when all three sides are of different lengths, isosceles when two sides have the same length, ...
Meal asked 12/12, 2016 at 18:21
7
Solved
I have a class with a static factory method on it. I want to call the factory to retrieve an instance of the class, and then do additional initialization, preferablly via c# object initializer synt...
Jesse asked 23/3, 2009 at 22:55
2
I'd like to subclass MKCircle (e.g. MyCircle) by adding another String property, let's call it "code". This property shall not be an optional and constant, so I have to set it from an initializer, ...
Sickening asked 30/9, 2014 at 9:30
4
Solved
Below are two different ways to initialize static readonly fields. Is there a difference between the two approaches? If yes, when should one be preferred over the other?
class A
{
private static ...
Choice asked 3/5, 2010 at 21:37
10
Solved
(I know) In c++ I can declare variable out of scope and I can't run any code/statement, except for initializing global/static variables.
IDEA
Is it a good idea to use below tricky code in order...
Harvell asked 16/9, 2014 at 8:39
2
Solved
The cppreference page for "if" statement;
https://en.cppreference.com/w/cpp/language/if
gives the following example;
Except that names declared by the init-statement (if init-statement is a d...
Sparerib asked 4/1, 2019 at 10:50
2
Solved
I have several translations tucked away into an initializer like so:
GROUP_GOVERNANCE_STYLES = [
[I18n.t("constants.group_governance_styles.collective"), 1],
[I18n.t("constants.group_governance_...
Casemaker asked 10/3, 2013 at 20:12
2
Solved
This code works:
import UIKit
class wheel: UIControl {
}
But this code doesn't:
class wheel: UIControl {
override init(frame: CGRect) {
super.init(frame: frame)
}
It shows error "required ...
Yurev asked 8/4, 2016 at 14:32
4
Solved
It happened for me to write following code snippet in one of my UIViewControllers in my new iOS Swift Application.
var starButtonsCount = starButtons.count
@IBOutlet var starButtons: [UIButton]!
...
Faunie asked 16/12, 2018 at 15:53
3
Solved
I want to put my chargify conf inside the initializer,
but I found the initializer won't execute in my rails c, is there a way to invoke my initializers so I can test in my console?
Chargify.conf...
Mussulman asked 6/5, 2016 at 4:31
2
Solved
What is the equivalent of a static initialisation block in Kotlin?
I understand that Kotlin is designed to not have static things. I am looking for something with equivalent semantics - code is ru...
Traumatize asked 16/5, 2016 at 20:11
1
Solved
Coming up from another question:
Since C++17, auto x0{1, 2, 3, 4};, previously deducing an initialiser list, is not allowed any more (sure, we can use auto x0 = {1, 2, 3, 4}; instead...). Now as a...
Housemother asked 4/7, 2018 at 9:13
1
I'd like to set seed value of glorot_uniform kernel initializer in Keras.
model.add(Dense(50, input_dim=self.state_size, activation='relu', kernel_initializer='glorot_uniform(seed=0)'))
When I...
Nationality asked 7/6, 2018 at 5:30
1
Solved
The question How to initialize weights in PyTorch? shows how to initialize the weights in Pytorch. However, what is the default weight initializer for Convand Dense in Pytorch? What distribution do...
Stereograph asked 13/4, 2018 at 12:6
1
Solved
Basically, why is this valid:
auto p1 = new int[10]{5};
but this is not:
auto p1 = new int[10](5);
And more generally what are the rules for the new-expression initializer?
I found the followi...
Madaras asked 5/4, 2018 at 3:24
3
Solved
How does reduce function work in python3 with three parameters instead of two.
So, for two,
tup = (1,2,3)
reduce(lambda x, y: x+y, tup)
I get this one. This would just sum up all the eleme...
Whistler asked 25/10, 2013 at 11:58
1
Solved
I'm trying to write some logical statements in Perl6.
I've made logical operators:
multi sub prefix:<¬> ($n) {
return not $n;
}
multi sub infix:<∧> ($n, $b) {
return ($n and $b);
}...
Plumlee asked 25/3, 2018 at 3:48
2
Solved
I am starting to learn binary trees in cpp and dynamically allocated memories;
thus to initialize a struct I do this
struct node{
int val;
node* left;
node* right;
};
//Initialize:
node* root =...
Enthalpy asked 22/1, 2018 at 14:19
1
I am trying to create a subclass of URLSession in Swift (reason does not matter, but has to do with testing). I need it to work with a delegate and a specific URLSessionConfiguration, which is a re...
Apprehensive asked 8/1, 2018 at 21:42
4
Solved
import tensorflow as tf
x = tf.constant(35, name='x')
y = tf.Variable(x + 5, name='y')
# model = tf.global_variables_initializer()
with tf.Session() as session:
print("x = ", session.run(x))
# s...
Fourscore asked 1/6, 2017 at 6:6
1
Solved
I understand that, when running unit tests, the class is instantiated for each test method. Therefore, I see no difference in initialising members upon declaration versus in the TestInitialize meth...
Chlor asked 27/10, 2017 at 13:8
3
Solved
I have One Initializer method in my Swift file like below:
public init(frame: CGRect, type: NVActivityIndicatorType? = nil, color: UIColor? = nil, padding: CGFloat? = nil) {
self.type = type ?? N...
Morly asked 25/9, 2017 at 7:24
2
Solved
I'm trying to create a simple Swift subclass of UIBarButtonItem:
class LabelBarButtonItem: UIBarButtonItem {
let label: UILabel
init(text: String) {
self.label = UILabel(frame: CGRectZero)
se...
Cadmann asked 24/11, 2014 at 22:47
6
Solved
In a c# initialiser, I want to not set a property if a condition is false.
Something like this:
ServerConnection serverConnection = new ServerConnection()
{
ServerInstance = server,
LoginSec...
Creuse asked 12/7, 2010 at 13:54
© 2022 - 2025 — McMap. All rights reserved.