Skip to main content
-2 votes
1 answer
199 views

Having the scenario of a C++ library where a function does some calculations as it receives a container normally (not always) across multiples calls, and where the function needs to retain an ...
codev's user avatar
  • 43
1 vote
1 answer
72 views

I have a nested class that uses static vars to have class wide parameters and accumulators. If I do it as a standalone class it works. If I do a nested class and inherit the standalone class, it works....
05032 Mendicant Bias's user avatar
2 votes
1 answer
84 views

I have a problem performing several scenarios one by one in unit testing. I'm testing a function, where static variables are used and they store states of variables after previous test scenarios. Is ...
PatrykL's user avatar
  • 21
0 votes
2 answers
92 views

I have a list of names which is static. I want to save it in a an static jaggedArray (to avoid multiple copies of same data). I want to write something like below code public static string[][] ...
A_Shah's user avatar
  • 23
7 votes
1 answer
588 views

I'm learning Rust and while doing research on static variables I came across this comment from 2018: Rust requires everything to be thread-safe (even if you're not using threads, the concept of a ...
Zebrafish's user avatar
  • 16.3k
-3 votes
1 answer
94 views

I'm a student who is studying game engine structure. I've been managing shared resources through the Singleton Patterns Manager class while creating game engines. However, as the code got longer, the ...
Tee Mo's user avatar
  • 19
-1 votes
1 answer
58 views

When declaring static thread_local variable, then each thread has a copy of that variable. Imagine a thread then spins another thread, will this variable still be a copy in the nested thread?
SpeakX's user avatar
  • 427
0 votes
0 answers
34 views

I have an wildfly with 10 EARs inside /standalone/deployments. Each of these EARs has a lib called "my-lib.jar" on the /lib directory. This Lib has a class called ...
Vitor's user avatar
  • 376
0 votes
0 answers
102 views

Considering the following example: A class named ObjectFactory is defined to manage the creation of several classes. These managed classes should be registered with the factory so that we can create ...
Woody Huang's user avatar
3 votes
0 answers
42 views

I am writing a cryptographic program for my bachelor's. I've been uzing an mpz_t variable for exponentiation with the PBC library. Currently, to avoid running mpz_init on every exponentiation, I only ...
nazar's user avatar
  • 31
0 votes
1 answer
93 views

Inside a function, I have a static variable which is a struct, and only one of its fields are initialized: void func() { static constexpr xcb_change_window_attributes_value_list_t root_mask { ....
smac89's user avatar
  • 43.8k
2 votes
3 answers
137 views

Suppose I have the C++ code below template <int Id> struct Foo { static inline int x {}; }; int main() { using T0 = Foo<0>; using T1 = Foo<1>; ... using T999 = ...
user23773995's user avatar
-1 votes
1 answer
1k views

Assuming that we need to define a singleton with global read access with thread safety, the canonical method is to use OnceLock: /// A synchronization primitive which can be written to only once. /// /...
tribbloid's user avatar
  • 3,822
1 vote
2 answers
198 views

Consider: class Welcome{ static name="something"; // Throws an error } MDN says static will be supported from Chrome 42. But it is throwing a syntax error in Chrome 70 and below versions....
MOHAMED SIKKANDAR AFZAL M's user avatar
1 vote
0 answers
92 views

I am trying to create "plugin" factory. When an user requests creation of an object factory queries it's child factories and picks suitable one to create the object. Instances of child ...
KajzerSoze's user avatar

15 30 50 per page
1
2 3 4 5
55