297 questions
0
votes
1
answer
134
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
2
answers
93
views
Can a name introduced via using-directive or using-declaration be used as elaborated-type-specifier of a friend declaration?
Why do gcc, clang and msvc successfully compile the following code? (godbolt)
namespace impl {
class A;
} // namespace impl
namespace api {
using namespace impl;
} // namespace api
class B
{
...
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 ...
0
votes
1
answer
37
views
Type or namespace does not exist. ApplicationName.Models.Model
We're on Visual Studio Code, .NET 8 & Angular.
I changed the structure of my project and now I cannot use using directive in my app, it's driving me crazy.
Here is my structure: Structure
Expended ...
3
votes
1
answer
235
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 ...
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
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
votes
1
answer
80
views
#if and #elif doesn't work as intended in Cpp
I am trying to make some sort of easy way to define mcu that I use, and by defining mcu, different header files should be included. I tried doing it with #if and #elif directives :
#include "...
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; }
...
2
votes
1
answer
159
views
gcc 11.3.0 does not find operator despite using directive
The following code (a simplified example from a more complex code) fails to compile with gcc 11.3.0
#include <array>
#include <memory>
#include <tuple>
namespace tools {
template &...
0
votes
0
answers
35
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 ...
-2
votes
2
answers
1k
views
C++ "was not declared in this scope"
Heyo, basically I was writing this simple function to ask you how many cars you have, inputing the amount in the array, and assigning the names of the cars to the array aswell. Also made a for loop to ...
0
votes
0
answers
534
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 ...
1
vote
1
answer
79
views
C# Razor using statements inconsistently require explicit curly brackets
I have a .NET Framework 4.7.2 web application. I am receiving the following yellow screen error from some of my Views and Partial Views but not all of them:
Expected a "{" but found a "...
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:
...