Skip to main content
0 votes
1 answer
111 views

Global namespace changes depending on scope?

I have the following function defined in my Spyder startup file: # startup.py #----------- def del_globals(*names): for name1 in names: try: del globals()[name1] except KeyError: pass # ...
user2153235's user avatar
  • 1,265
0 votes
1 answer
853 views

How do I shorten a namespace within a class? [duplicate]

I want to shorten a namespace for use within MyClass, for example by using namespace or defining an alias: namespace foo = really::loong::name::space; class MyClass { private: foo::FooClass f; // ...
H.v.M.'s user avatar
  • 1,746
3 votes
1 answer
171 views

In C++20, the get<>() function inside <tuple> is no longer in namespace std. Why? [duplicate]

The following code does not compile in C++17 but from C++20 on: #include <tuple> int main() { auto t = std::make_tuple(1, 2); get<0>(t); // no std:: required! return 0; } ...
mqnc's user avatar
  • 766
2 votes
2 answers
6k views

Visual Studio 2022 file-scoped namespace issue

So I have VS 2022 and am trying to learn C#. I am getting an error of Feature 'file-scoped namespace' is not available in C# 7.3 Please use language 10.0 or greater. I found where one goes to ...
WinginSue's user avatar
0 votes
0 answers
19 views

How do I make a module make use of a variable defined globally in Jupyter-notebook?

So I have a jupyternotebook main.ipynb. I have to submodules named x.py and y.py. x.py contains the line x = 30 and y.py contains the line y = 2*z I know how I can use the variable defined in the ...
AayushNepal's user avatar
0 votes
0 answers
112 views

Is there a better way to add local variables in the global namespace?

I use the following approach (code below) to add all the local variables from a function to the global namespace. Is there a better way to do this? This specific case is not for general practice, but ...
Nomesis's user avatar
  • 21
2 votes
1 answer
130 views

Check if string is type

I wish to parse keyword arguments to determine if they also refer to types, such as in the case below: from inspect import isclass def convert(converting, **kwargs): for key, value in kwargs.items(...
syvlorg's user avatar
  • 409
1 vote
1 answer
242 views

Global Namespace Alias (double colon) with curly brackets in comment - C#

I want to call some method in curly brackets in a comment, for example like this: $"{global::Company.Company.Helpers.Method()}_{Parameters.ProcessName}"; But in this situation everything behind the ...
Kacper Sierakowski's user avatar
0 votes
1 answer
2k views

The type name XXXX does not exist in the type XXXX

I have the following code (which compiles and works fine if I leave the warning in, I haven't tested it using the global:: hack): namespace NotifierService.Models {} namespace NotifierService { ...
BLoB's user avatar
  • 9,787
0 votes
1 answer
705 views

Accessing carbon_get_post_meta value inside of a namespace

How can I access a Carbon Fields value using the function carbon_get_post_meta from within a namespace? If I do: if ( function_exists( 'carbon_get_post_meta' ) ): echo 'true'; else: echo '...
Stuart's user avatar
  • 45
0 votes
0 answers
55 views

How can I access a running thread

By starting the main, I´m starting a thread that keeps a connection to a opcua server alive (and a few things more). I now want to open a function inside this thread but I don´t want to import ...
Flu's user avatar
  • 49
0 votes
2 answers
476 views

Showing Garbage values in Structures in c++

#include<iostream> using namespace std; struct student { char name [50]; int roll; float marks; }s = {"Karthik",1,95.3}; int main() { struct student s; cout<<"\nDisplaying ...
karthik oggu's user avatar
3 votes
2 answers
168 views

How to provide swap() for a class in the global namespace?

For a class in a namespace the proper way to provide swap() is to define a free function in that namespace (e.g. How to overload std::swap()). But what is the best practice for a class that's in the ...
Dan Stahlke's user avatar
  • 1,479
9 votes
4 answers
4k views

Where is size_t Defined? [duplicate]

So I know any header from the C Compatability Headers: Places in the global namespace each name that the corresponding cxxx header would have placed in the std namespace I also know that these C ...
Jonathan Mee's user avatar
  • 39.1k
2 votes
0 answers
424 views

CreateMutex() returns ERROR_ACCESS_DENIED on Win 10 but not on Win 7

I have 2 windows programs one that runs at Session 0 and another at Session 1. Both programs creates the same named mutex with the 'Global\' namespace prefix, Session 0 creates first and when Session ...
IdolAdmin's user avatar

15 30 50 per page