using-directives Questions
2
Solved
I have got 5 C# files that have 20 using directives in common. I want to get rid of this code duplication, especially because these 20 using directives belong logically together. In C or C++ I woul...
Symphysis asked 1/7, 2014 at 14:32
5
Solved
I find that my C++ header files are quite hard to read (and really tedious to type) with all the fully-qualified types (which goes as deep as 4 nested namespaces). This is the question (all t...
Mendy asked 6/12, 2010 at 3:3
1
Solved
Given a custom type, the following fragment shows the common approach for allowing a function to automatically select a user provided overload specific to the type, or a generic implementation of a...
Perturbation asked 29/1, 2014 at 0:59
2
Solved
Is the following example well-formed?
namespace N {
class A;
}
using namespace N;
class B {
int i;
friend class A;
};
namespace N {
class A {
B m;
int get() { return m.i; }
};
}
This ex...
Bonham asked 9/1, 2014 at 19:36
4
Solved
The established idiom for invoking swap is:
using std::swap
swap(foo, bar);
This way, swap can be overloaded for user-defined types outside of the std namespace.
Should we invoke begin and end ...
Antimonic asked 13/9, 2013 at 7:9
6
Solved
There are convincing arguments against using namespace std, so why was it introduced into the language at all? Doesn't using namespace defeat the purpose of namespaces? Why would I ever want to wri...
Hypophosphate asked 5/12, 2010 at 16:9
2
Solved
I had a problem today using the using keyword in C++11. I decided to use another approach now (added as comments in the example below). You can think of X as a matrix, of Y as a mixin and the aim i...
Mosa asked 24/7, 2012 at 13:28
3
Solved
Please refer to the code below:
#include <algorithm>
namespace N
{
template <typename T>
class C
{
public:
void SwapWith(C & c)
{
using namespace std; // (1)
//using std:...
Descry asked 22/4, 2013 at 17:8
6
Solved
I recently saw this code being used in a source file in a C++ project:
using namespace std;
#include <iostream>
Ignoring all issues of whether it's a good idea to have using namespace std ...
Hogweed asked 27/7, 2011 at 7:55
3
Solved
I'm trying to generate an n-level hierarchical unordered list with anugularJS, and have been able to successfully do so. But now, I'm having scope issues between the directive and controller. I nee...
Pirbhai asked 13/3, 2013 at 15:2
4
Solved
In C#, when you add a using directive for a namespace, it gives you access to all the types in that specific namespace. However, if the namespace has a lot of types and I only need one particular o...
Thurnau asked 13/3, 2013 at 17:50
1
Solved
When I try to write a new using clause, I notice that Intellisense has, in its list, a namespace called Standard. However, this seems to have no members on closer inspection. What is this namespace...
Birkle asked 22/2, 2013 at 15:5
5
Solved
#include <iostream>
using namespace std;
void swap(int *a, int *b) {
*a = *a^*b;
*b = *a^*b;
*a = *a^*b;
}
int main()
{
int array[]={1,9,2,8,3,7};
for(int i=0; i<6; i++)
cout<&...
Gore asked 24/1, 2013 at 19:41
1
Solved
For the following code
#include <array>
template<unsigned MaxP, typename type>
struct kernel
{
static constexpr unsigned max_pole(unsigned P)
{ return P>MaxP? MaxP:P; }
templat...
Nuts asked 15/1, 2013 at 13:31
2
My original class structure was similar to:
//def.h
namespace A
{
struct X {};
}
and forward declarations where needed:
//file that needs forward declarations
namespace A { struct X; }
After...
Ariosto asked 9/1, 2013 at 13:0
2
Solved
I have two snippets for ADL for demo purposes. Both snippets have been compiled by VC10, gcc & comeau C++ compilers, and the result are the same for all three.
<1>ADL against using directiv...
Occupational asked 5/10, 2012 at 14:15
2
Solved
From section 7.3.4.2 of the c++11 standard:
A using-directive specifies that the names in the nominated namespace
can be used in the scope in which the using-directive appears after
the using-...
Gobang asked 20/9, 2012 at 16:1
1
I've easily gotten myself into the habit of prefixing standard identifiers with std:: instead of sticking in a using namespace std;. However, I've started getting into C# and I've noticed that it's...
Luxor asked 4/9, 2012 at 3:55
2
Solved
my goal is to understand how to use angularJS correctly. I want to be able to tie a selection of variable to dynamically changing the DOM structure using angularJS. I dont think I'm quite understan...
Chlamydeous asked 7/8, 2012 at 20:19
1
Solved
Possible Duplicate:
What are the differences between typedef and using in C++11?
The following code compiles and runs. My question is what is the difference between the "typedef" and ...
Vaseline asked 27/6, 2012 at 10:38
4
Solved
I am writing a library with mutiple dependent modules. When I include a file from a different module, should I resolve the namespace with:
using namespace project1::namespace1;
class1 obj;
...
Motionless asked 26/4, 2012 at 10:23
2
Solved
I come from a VB.Net environment, where using Imports System and then IO.Directory.GetFiles(...) works.
On the other hand, it seems that using System; is not sufficient to write use IO.Directory w...
Littles asked 24/2, 2012 at 15:9
7
Solved
I'm wondering where to put using namespace std;. I saw a code with the using namespace std; in the int main(){} but I was putting it after #include <iostream>. Where should I put it and does ...
Kelby asked 24/6, 2011 at 23:33
5
Solved
Good programming practice these days tends to mean splitting your stuff up into lots of assemblies and namespaces (for example, see S#arp Architecture, MVC, etc.). However a side-effect of that is ...
Anora asked 15/2, 2011 at 22:20
2
Solved
I have a silly problem with Twitterizer2 and probably me :) . I add the reference twitterizer 2.3.1 from my downloads directory along with the newtonsoft one by right clicking on references and bro...
Veratridine asked 17/11, 2010 at 10:58
© 2022 - 2024 — McMap. All rights reserved.