Skip to main content
Filter by
Sorted by
Tagged with
2 votes
1 answer
77 views

I’m working with Swift and I’ve documented my class initializers using ///. However, when I create an object with let obj = MyClass(...), the documentation does not appear when I Option-Click the ...
Alex Navarro's user avatar
12 votes
7 answers
2k views

I am developing a C++17 framework that has optional third-party dependencies and I'd like to construct an std::array that contains the names of the available dependencies. The CMake file sets ...
Charlie Vanaret - the Uno guy's user avatar
1 vote
1 answer
49 views

This question is a follow up to the question here AspectJ @around a static initializer I accepted that answer because it did apply the aspect to the code, but i hadn't actually run it yet to see there ...
MeBigFatGuy's user avatar
  • 28.7k
0 votes
1 answer
66 views

I'm attempting to use a point cut of @Around("staticinitialization(*)") but when applying i get this error: [iajc] [error 4]: error at /home/dave/dev/coyote/projects/aspects/debug_src/com/...
MeBigFatGuy's user avatar
  • 28.7k
0 votes
1 answer
100 views

I am compliling a C++ file (on a Raspberry Pi5 running Debian 12 with Gnu C++) and the file is auto-generated from a XML datafile. The file just has some const arrays of structs. One of the arrays ...
Robert Heller's user avatar
0 votes
0 answers
32 views

Simple question here: is it possible to get an object initilized through app startup Initializer inside a Hilt module? Let me provide an example. Assume that I've the following Initializer: class ...
Carlo Codega's user avatar
2 votes
2 answers
123 views

Why is the following an error and what is the correct syntax? struct a { int b[4]; }; int c[4]; struct a a = {.b = &c}; Shouldn't a.b be of type int * or int[], why is it of type int? (Note, ...
Caulder's user avatar
  • 459
0 votes
0 answers
61 views

I have a view controller with a button. Once clicked, a new view controller is suppose to be presented. CropperViewController @IBAction func cropImageAction(_ sender: AnyObject) { ...
Amen Parham's user avatar
3 votes
2 answers
144 views

I have many data array defined in my code with the length only specified in the array initializer. int a[] = {1, 2, 3, 4}; int b[] = {1, 2, 3, 4, 5}; For cache line coherence consideration, I want to ...
Eric Sun's user avatar
  • 973
0 votes
1 answer
139 views

I'm working on a Swift project where I have two model classes: PlaylistGroup and PlaylistItem. I'm running into an issue where I can't append items to the playlistItems property in PlaylistGroup. ...
Damiano Miazzi's user avatar
1 vote
1 answer
238 views

Apple's documentation and many articles suggest you can convert a substring (string.subsequence) to a string just by calling String(substring)and in fact this works. let str = "Hello world" ...
user6631314's user avatar
  • 2,050
3 votes
1 answer
224 views

I'd like to be able to conditionally declare a variable constexpr, according to properties of its initializer. My actual use case is a bit complicated but it can be summarized to: #include <cmath&...
Oersted's user avatar
  • 3,834
1 vote
1 answer
98 views

I want to use the local db "isar" in flutter together with cubit state management. In the following code: The variable "isarIn" is initialized in the main() method Then passed to ...
Rasputin221's user avatar
3 votes
1 answer
85 views

I have a class with multiple constructors, one being variadic and one taking an additional callable before the variadic arguments. However, the objects I create result in overload resolutions I dont ...
Philipp317's user avatar
0 votes
2 answers
122 views

In C# you can initialize Dictionary<TKey,TValue> like this: var dictionary = new Dictionary<int, string>() { [0] = "Hello", [1] = "World" }; You can also ...
user3163495's user avatar
  • 3,968
0 votes
1 answer
39 views

In pure Python I can make it easily: from random import choice def init_by_plus_or_menus() -> int: return choice([-1, 1]) Keras documentation uses in the example Keras.backend (tf) function: ...
Maksim Shavrin's user avatar
3 votes
1 answer
120 views

I have this sample of code: struct S {}; S s = S(); Per my understanding, I see that s = S() in the declaration S s = S() is an init-declarator where s is a declarator and = S() is an initializer. ...
mada's user avatar
  • 2,033
-4 votes
1 answer
205 views

I'm trying to run this code but on the terminal it says 'initializer element is not a compile-time constant: #include <cs50.h> #include <stdio.h> int main(void) int i = get_int ('first ...
boineelo's user avatar
1 vote
1 answer
59 views

Sorry if this has already been answered, but I haven't been able to find the answer myself. I was wondering if it is possible to create a custom function initializer? Something like this: const ...
Eksperiment626's user avatar
1 vote
1 answer
84 views

I have a struct MyStruct. It can be initialized from a String, but there are many ways for the String to be invalid. Rather than simply creating a failable initializer init?(string: String) which ...
Anton's user avatar
  • 3,399
-1 votes
1 answer
487 views

#include <iostream> using namespace std; int main() switch(age) { case 1: case 2: case 3: case 4: cout<< "Tricycle"<<endl; break; case 5: . . case 15: if (15 >= age >...
Nonhle_Tavie's user avatar
1 vote
0 answers
102 views

Given this class which takes a map as a constructor parameter struct Map { Map(const map<string, string>& map) { } }; And this sample code to create it string s; Map j({ {s, s}})...
Jay Evans's user avatar
  • 255
-1 votes
1 answer
604 views

In my App i want to initialize an @StateObject property that takes a binding in its initializer. I created an example project to try fixing this problem. struct ContentView: View { @StateObject ...
neldierto's user avatar
0 votes
2 answers
48 views

I used a ForEach to present the calender. I am missing something in my code and can't place my finger on it. Any help is needed. This is the error: No exact matches in call to initializer import ...
EMPIRE's user avatar
  • 57
1 vote
1 answer
98 views

If we start from AoS layout, AoS structs can be easily initialized as such: struct Position { float x; float y; }; struct Position positions[] = { { .x = 1.f, .y = 2.f }, { .x = 20.f, .y = ...
aganm's user avatar
  • 1,449
-1 votes
1 answer
163 views

The default memberwise initializer for a structure type is considered private if any of the structure’s stored properties are private. (Source: https://docs.swift.org/swift-book/documentation/the-...
Ryu Hiroyama's user avatar
1 vote
2 answers
477 views

I have a program from official android tutorials about creating a database. The program has lots of viewmodels which I guess are instantiated in viewModelFactory. But what does the keyword "...
Евгений s's user avatar
0 votes
1 answer
90 views

I like a timer to start when an object is created. (see code below in playground). My problem is the timer seem to never start. How can I start a timer when a Object is created? import Foundation ...
marc0's user avatar
  • 21
0 votes
1 answer
92 views

I tried merging a collection definition with a collection initializer in C#, but failed to initialize the collection. See the codes: using System.Collections; using System.Collections.Generic; using ...
SilverLawrence's user avatar
0 votes
1 answer
257 views

In openzeppelin's Initializable.sol library(v4.7.0), there is a modifier initializer() that checks if a function has already been initialized. In the require statement, it checks the value of ...
bzpassersby's user avatar
0 votes
1 answer
142 views

I am studying flutter while making a pomodoro app. After setting this app to 25 minutes, press the middle button to decrease the time by seconds and press the button again to pause. I am getting the ...
panicTrading's user avatar
0 votes
1 answer
60 views

I've only ever heard of a static initializers with the syntax "static {...}". But in this book, Core Java by Cay Horstmann, there's some code like this: (private static Holder {...}) 12.4....
sevengold's user avatar
2 votes
2 answers
170 views

I would have liked to do something like this: template<typename T> class RasterView { T* data; unsigned stride; RasterView(T* data, unsigned stride) : data(data) , ...
Museful's user avatar
  • 7,019
1 vote
0 answers
193 views

#include <memory> struct Something { int x; long y; }; int main() { std::unique_ptr<Something> k = std::make_unique<Something>(0, 1); return 0; } This program ...
Kitswas's user avatar
  • 1,234
0 votes
0 answers
126 views

I'm using Code::Blocks (v20.03) with MinGW64 g++ compiler (Windows 11), g++ --version shows (first line): g++.exe (MinGW-W64 x86_64-ucrt-posix-seh, built by Brecht Sanders) 12.2.0 When trying to ...
raku99's user avatar
  • 57
0 votes
1 answer
362 views

How can I initialize bias with a pre-defined vector (no constant or random)? For example, I would like to spread up the vector in the range [-1, 1]. Something likee this: tf.linspace(-1, 1 , shape, ...
deijany91's user avatar
0 votes
2 answers
146 views

I'm trying to build an app (macOS, but would be the same for iOS) that creates a number of grids, the outcome of which is to be shown in a second screen. For this, I'm sharing data across these ...
quoteunquote's user avatar
3 votes
1 answer
399 views

Suppose I have function declarations like these: static const int R = 0; static const int I = 0; void f(const int& r = R); void g(int i = I); Per [dcl.fct.default]/1: If an initializer-clause ...
mada's user avatar
  • 2,033
4 votes
1 answer
149 views

I am using a .NET framework which allows to pass an object initializer LINQ expression when called from C#: db.UpdateAdd( () => new InvoiceAccount { Quantity = 3 } ); The framework uses the ...
Marek Vaculciak's user avatar
1 vote
1 answer
159 views

Say I have a struct with an array inside it: struct my_struct { // 128 will be enough for all of my use cases, // saves me from using malloc. double values[128]; int value_count; ...
aganm's user avatar
  • 1,449
-2 votes
1 answer
140 views

I didn't understand the difference between these codes. One of them is compiled, the other one isn't. { if (true) { try { throw new IOException(); } catch (IOException ...
Mammad Yahyayev's user avatar
0 votes
1 answer
201 views

When initializing a struct using curly braces, it does not seem to work with an array of chars. I can write an equivalent constructor that works below. Is there any syntax so I don't have to write the ...
Dov's user avatar
  • 8,644
0 votes
1 answer
527 views

I could not get the constructor logic with the below code block. In the named constructors we use ClassName({this.variable or required this.variable}); But, in the below example the developer choose a ...
devfoz's user avatar
  • 166
0 votes
3 answers
87 views

I know in c++11 I can use initializer to create array/vector elements one by one like: int ar[10]={1,2,3,4,5,6}; vector<int> vi = {1,2,3,4}; This is done manually, but what if I wish to ...
Troskyvs's user avatar
  • 8,267
0 votes
1 answer
82 views

Consider the following C code: #include <stdio.h> int x = 5; int y = x-x+10; int z = x*0+5; int main() { printf("%d\n", y); printf("%d\n", z); return 0; } The ANSI ...
WacfeldWang's user avatar
0 votes
1 answer
133 views

This is kind of a duplicate of c#, using lambdas with collection initialization, but its 13 odd years old and things have changed. Hopefully. I'm writing a one off unit test, so I'm not looking for ...
Greg Smith's user avatar
1 vote
2 answers
135 views

here are two similar declarations of an object type in C++: struct Obj { int x; }; struct ObjC { int x; ObjC(int x) : x(x) {}; }; Obj obj1 = {100} ObjC obj2(200); using a recent version ...
biosbob's user avatar
  • 331
0 votes
1 answer
29 views

I am new to ruby and I am trying to create a hangman game, to do so I need to create a new game each time the user click on a button. First step is to create the same object each time the methode ...
Le Garrec Arnaud's user avatar
0 votes
1 answer
38 views

I am new to ruby and I am trying to create a hangman game, to do so I need to create a new game each time the user click on a button. First step is to create the same object each time the methode ...
Le Garrec Arnaud's user avatar
1 vote
2 answers
786 views

I am trying to setup Stripe checkout as described in this GoRails episode I have defined the publishable_key and secret_key in application.yml using the figaro gem so in my config/initializers/stripe....
kouroubel's user avatar
  • 280

1
2 3 4 5
15