1,826 questions
2
votes
1
answer
106
views
Declaring aliases for anonymous classes
This is an attempt to make an alias to an anonymous class:
struct {
int i = 0;
} a;
// error C7626 in MSVC
using A = decltype(a);
This produces an error in Visual Studio:
error C7626: unnamed ...
2
votes
1
answer
86
views
How to handle Disposing of CryptoStream after exception occurs during decrypt
C# .Net Framework 4.8.
I am using CryptoStream Reader to decrypt an encrypted datastream within a Using {} block.
If the Key used for decryption is incorrect, the CryptoStream Reader throws an ...
2
votes
1
answer
67
views
Postgres using clause in stored procedure/function not working
I have a stored procedure in which, through dynamic SQL, I want to delete rows where energy = 0. This works allright as long as I use string concatenation for the query build-up. But when I try to use ...
2
votes
1
answer
138
views
Using conversion operator with automatic return type deduction from base class
The following not very long program is treated differently by the current compilers:
class A {
protected:
operator auto();
};
template<class>
struct B : A {
using A::operator auto;
};
...
0
votes
0
answers
102
views
GCC plugin, detect 'typedef' and 'using'
I'm writing a GCC plugin and would like to identify typedef and using.
plugin.cpp
#include <gcc-plugin.h>
#include <tree.h>
#include <tree-pretty-print.h>
#include <plugin-version....
-1
votes
2
answers
154
views
Implementing IDisposable/IDisposeAsync as an abstract base class [closed]
This question is specific to multi-threaded applications under .NET 9.
I often deal with COM Interop scenarios where references must be disposed of in a specific order, while the order of obtaining ...
2
votes
0
answers
113
views
Deprecation of typedef does not work on GCC and MSVC (does on Apple Clang) when used as a stream operator argument
In our code we have a class which has an alias (typedef), and we are trying to deprecate that alias. We do not want to deprecate the original class (really, the class with its new name). We want to ...
0
votes
0
answers
62
views
Snowflake join using between =incorrect values
I am using Snowflake, joining two tables using zip codes.
One table has a zip code , other has a value linked to zip code from - zip code to combination.
Zip codes go from all numbers to numbers and ...
1
vote
2
answers
111
views
Using std::conditional with function types [duplicate]
I am trying to define a function type alias that depends on a template parameter, T. Specifically the function type is of the form void foo(T) if T is not void, and void foo() if it is void.
#include ...
0
votes
2
answers
276
views
Does the guidance against using in headers apply to type aliases?
I'm aware of the guidance to not use using in C++ header files, the reasons for which have been widely discussed, e.g. here.
I was looking for a more C++ alternative to typedef when I came to this ...
3
votes
1
answer
91
views
Writing into the same file with two `using` statements and two writers
I am trying to open a file in c#, then write some text into it, and conclude by dumping a compression of a bytes array into the same file. So, the file I want to create is something like
...
-4
votes
2
answers
79
views
How can i select one of declared structure and make alias? [closed]
enum class Color { RED, BLACK };
enum class TreeModel { AVL, RED_BACK, SPLAY }
struct BasicNode {
BasicNode* left;
BasicNode* right;
BasicNode* parent;
};
struct SplayNode : BasicNode {
...
1
vote
2
answers
151
views
Ambiguous variable reference in C++
I have this piece of code
#include <iostream>
namespace ns{
int a = 10;
}
using namespace ns;
int a = 20;
int main(){
std::cout << a;
}
As per my understanding, when std::cout &...
0
votes
1
answer
45
views
How to use "using variable" in Julia
I am trying figure out if it is possible to use package name not explicitly as eg DataFrames etc or as a String variable with a name of this module with using. My test code is:
dependencies=["CSV&...
0
votes
1
answer
52
views
How to use variable value declared in Microsoft PowerPoint Object module in Main Module
I need to refer the variables in slide object modules to refresh the charts which I am struggling since a week.
Could anyone help me please?
I just need make Slide2146449163 as variable since SRngMkt, ...
2
votes
0
answers
38
views
gcc-11 compiler problems with multiple inheritance and statement "using" [duplicate]
I am having problems with gcc-11 C++ compiler when using multiple inheritance
and I want to call a specific method of the base class and I write using A::m1 explicitely.
Visual C++ 2022 works with ...
2
votes
2
answers
152
views
Using decltype for templated function declaration results in "conflict" when defining the templated function
I am using a decltype to ensure a template function force2 has the same parameter and return types as another template function force1 but it doesn't compile. I require the functions to be templated.
...
1
vote
2
answers
86
views
Do I need both Dispose() and Complete() methods in a transaction to achieve a roll back in case of failure?
In the following code do I need both of the these methods in order to achieve a rollback in case of a failure; Or the Using-End Using covers that case already?
Public Function ProcessMultipleMessages()...
0
votes
0
answers
153
views
Don't know how to use namespace of one project in another
I'm new to C# and JetBrains Rider and I'm having trouble using a namespace of a project in another project. I have one project with a namespace called math which I want to test through unit tests in a ...
0
votes
1
answer
94
views
Using keyword with virtual inheritance in cpp
I want to resolve an inheritance problem of my Paladin class. Here is a resume of the inheritance between my classes :
class Peasant
{
virtual int attack();
}
class Knight : virtual public ...
0
votes
1
answer
46
views
Loop Inside a dotnet using stament
I have this code
public static void AddMeter(List<string> meter)
{
using MeterProvider meterProvider = Sdk.CreateMeterProviderBuilder()
.AddMeter("Meter.Errors")
...
1
vote
0
answers
46
views
Why is the `using System` directive not necessary here? C# | Visual Studio Code [duplicate]
The C# doc on the using directive says
The using directive allows you to use types defined in a namespace without specifying the fully qualified namespace of that type.
I understood this to mean ...
0
votes
1
answer
85
views
c++ type aliases ambiguity when initializing fully specialized template
I am trying to initialize my template class with a type alias as template parameter, but only the specialized version of my class is created. I understand the problem is in the ambiguity of my aliases....
0
votes
0
answers
63
views
Monadic log function writing to file utilizing 'using' keyword
There's a new context manager on the block. with died quietly, so naturally it's time to re-brand and revive :)
Setup:
Looking at the new using keyword I immediately found a scenario where it would be ...
0
votes
1
answer
877
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;
// ...