297 questions
0
votes
1
answer
142
views
In Visual Studio 2022 using C#, does Microsoft.Office.Interop.Outlook.Application or Excel.Application implement System.IDisposable?
I have Visual Studio 2022 and this line of code
using (Excel.Application xlApp = new Excel.Application())
throws an error
CS1674 'Application': type used in a using statement must implement 'System....
1
vote
1
answer
93
views
Unqualified name lookup after using-directives in C++
From cppreference :
From the point of view of unqualified name lookup of any name after a using-directive and until the end of the scope in which it appears, every name from namespace-name is visible ...
3
votes
1
answer
245
views
Why does using ranges::sort work in a function but not at global namespace when trying to salve ambiguity in calling sort()?
I last used C++ at the 98 with boost/C++11 simulation. I am reading Stroustrup's "A Tour of C++, Third Edition" to help introduct the things I will need to learn more about. Following ...
0
votes
0
answers
25
views
Visual Studio @using statements get altered
I have a VS issue, VS2022 but it also happened in the previous version. In fact its been happening for a few years.
When I do certain operations, often moving files within VS, I find I get a load of ...
1
vote
1
answer
48
views
Contrasting solutions for visibility when inheriting from base class templates
In the following code will fail to compile because, despite the chain of public inheritance, HasFlag is not visible in DerivedFoo.
class BasicFoo {
public: bool HasFlag() const { return m_flag; }
...
0
votes
0
answers
37
views
Import certain overloads of base class to private scope of derived [duplicate]
Using the using-directive I'm able to select a certain set of methods from the base class to put into a different access scope. Is this also possible for individual overloads of the method? Something ...
0
votes
0
answers
551
views
How can I reuse "type alias" in another project?
I have a project with some interfaces that contains some type alias in it, for example like below:
namespace UsingTest
{
using MyType = System.Collections.Generic.List<int>;
public ...
2
votes
3
answers
97
views
Avoid template mess when importing base class constructors of heavily templated base class
This is just short inquiry if it is at all possible to somehow import base class constructors without all the template bloat. Consider this example where I'm inheriting from a templated std::variant:
...
16
votes
2
answers
14k
views
How do I control what usings are made global in a C#10 / .NET6.0 project?
C#10 in .NET 6.0 supports a new feature called global using directive.
It seems to do 2 things:
When you have a namespace in the global using, you don't have to include the using ... for that ...
1
vote
1
answer
374
views
Namespace and Using with 'System' in it
I have a library - Foo.System.Management
I have an application - Foo.New.Application
In this application, Using System; is imported, and what ends up happening is this is being resolved to Foo.System ...
-1
votes
1
answer
67
views
How below macro is working in c programming language? [closed]
Code:
#include <stdio.h>
#define puts "%s C preprocessor"
int main()
{
printf(puts, puts);
return 0;
}
Output:
%s C preprocessor C preprocessor
See also...
Can anyone explain ...
0
votes
1
answer
99
views
What's the relevance of the Note in [over.load]/1?
(You might see this question as a duplicate of this, but, to be honest, I've not really understood the matter, so I'm asking separately with my own wording.)
[over.load]/1 reads:
Not all function ...
1
vote
2
answers
1k
views
Why does StyleCopAnalyzers think that global usings should be declared within a namespace, when such syntax is not possible?
I am creating a NUnit test project and in the creation of that, MS Visual Studio has created a file called Usings.cs with the line
global using NUnit.Framework;
which tells the project to include the ...
0
votes
0
answers
39
views
Type alias with "using" inside class cannot be used as return type [duplicate]
I'm currently switching from Java to C++ and I have troubling understaning the following problem.
I have a header file for a class (AClass.h):
#ifndef ACLASS_H
#define ACLASS_H
#include <cstdint&...
0
votes
2
answers
53
views
simplify using base template class statement
Often in derived template classes I need to refer to the base to access members. I end up writing code like this:
template<typename A>
struct BaseClass
{
};
template<typename B>
struct ...
1
vote
2
answers
2k
views
Using UnityEngine.Animations.Rigging; not found
My Unity project has the Animation Rigging Package. As we all know if we write a script where we need to reference some kind of Rig we must use the namespace/using direction for this package. Here is ...
0
votes
2
answers
628
views
Get template parameter of derived class from base object
In short:
I have a base class A_base without template parameters and a derived class A that has two.
The function foo() only accepts base class objects
foo() is supposed to return an object which has ...
2
votes
1
answer
407
views
About the ambiguity of using a name vs using a namespace when doing unqualified calls
I knew that this would be ambiguous
#include <boost/hana/fwd/equal.hpp>
#include <range/v3/algorithm/equal.hpp>
#include <vector>
int main() {
std::vector<int> v{1,2,3};
...
2
votes
2
answers
139
views
Impact of namespaces on C++ template deduction priority
while trying to implement a metafunction, which needs to exist only if the "abs" function exists for some type, i ran into the folowing problem:
Here are two examples of code i would expect ...
4
votes
2
answers
3k
views
What is "using namespace::std" in C++
I am reading some code snippets from others and I find a line:
using namespace::std;
I suspect its purpose is using namespace std;, with some typos. But to my surprise the compiler accepts this code ...
1
vote
3
answers
866
views
can "using namespace std;" and "std::cout" be used together?
No error occurs when using using namespace std; and std::cout together. Can these two be used together?
#include <iostream>
using namespace std;
int main() {
std::cout << "...
1
vote
2
answers
166
views
using namespace in c++
I have come to understand why using namespace std; is considered bad practice in c++
but let's consider for example 2 ( hypothetical ) libraries "std" and "sfd" , both of them ...
1
vote
2
answers
138
views
Extremely basic question about namespaces in c++
using namespace X;
cout << var;
using Y::var;
cout << var;
So say I have a namespace X and a namespace Y that both contain a variable of type int called var. When I say using ...
1
vote
1
answer
334
views
Passing a nullptr to my overloaded function causes a runtime error
To understand more using directives and function overloading I've tried this program:
namespace ns{
void f(int){cout << "int\n";}
void f(double){cout << "double\n&...
2
votes
1
answer
106
views
problem when I separate code to header file [duplicate]
this program works correctly but when I separate that "Class StudentsName" and put it on the header file it doesn't work correctly. I add the header file in my project by right click on the ...