using-directives

Twitterizer 2 and C# - Namespace could not be found

荒凉一梦 提交于 2019-12-04 02:27:21
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 browsing to find them. I then add using Twitterizer; lo and behold all my squiggly red underlines go away on all this sort of code: OAuthTokens tokens = new OAuthTokens(); when I go to run it(with debug), I get an error: Error 2 The type or namespace name 'Twitterizer' could not be found (are you missing a using directive or an assembly reference?) Now using Twitterizer; becomes in error(red and

using directive vs using declaration swap in C++

岁酱吖の 提交于 2019-12-03 09:04:46
问题 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::swap; // (2) swap(a, c.a); } private: int a; }; template <typename T> void swap(C<T> & c1, C<T> & c2) { c1.SwapWith(c2); } } namespace std { template<typename T> void swap(N::C<T> & c1, N::C<T> & c2) { c1.SwapWith(c2); } } As written above, the code doesn't compile on Visual Studio 2008/2010. The error is: 'void N::swap(N::C

Drilldown charts in angular js using google charts directives

跟風遠走 提交于 2019-12-01 14:40:11
We are new to angularjs v4. We have a requirement of drilldown charts in google charts. We are using ng2-google-charts directives. We are able to find the select event and updated the data. but chart is not reloading. Could any one please help on this. view: index.html <pre> <br/> <google-chart #drillchart [data]='pieChartData' type="BarChart" (chartSelect)='select($event)'> </google-chart> </pre> Component.ts: pieChartData = { chartType: 'BarChart', dataTable: [ ['Country', 'Poulation'], ['Ind', 25], ['Rus', 10], ['Chi', 30], ['USA', 15], ['UK', 12], ['Aus', 8] ], options: {'title':

Can class members be defined outside the namespace in which they are declared?

六月ゝ 毕业季﹏ 提交于 2019-12-01 03:11:54
Sometimes I find code like the following (actually some class-wizards create such code): // C.h namespace NS { class C { void f(); }; } and in the implementation file: // C.cpp #include "C.h" using namespace NS; void C::f() { //... } All the compilers I tried accept that kind of code (gcc, clang, msvc, compileonline.com). What makes me feel uncomfortable is the using namespace NS; . From my point of view C::f() lives in the global namespace in an environment that has unqualified access to objects living in namespace NS. But in the compiler's opinion void C::f() lives in namespace NS . As all

Namespace references in C# vs. VB.Net

半世苍凉 提交于 2019-11-30 18:44:05
In VB.Net you can do something like the following without any issues... just ignore the fact that this is a pretty useless class :-) Imports System Public Class Class1 Public Shared Function ArrayToList(ByVal _array() As String) As Collections.Generic.List(Of String) Return New Collections.Generic.List(Of String)(_array) End Function End Class However if you do the same thing in C#... using System; public class Class1 { public static Collections.Generic.List ArrayToList(string[] _array) { return new Collections.Generic.List(_array); } } You will get an error on the line with the return on

where to put using namespace std;

自作多情 提交于 2019-11-30 11:43:15
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 it make any difference where I put it? Peter Alexander It makes a huge difference where you put it. If you put it inside a function, then it only applies in that function. If you put it outside a function in global scope then it applies to everything after that point. If you put it outside a function in global scope in a header file then it will even apply to ever file that includes that header.

distance calculation error in c++ [closed]

谁说我不能喝 提交于 2019-11-30 07:43:52
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . #include <iostream> #include <cmath> #include <vector> using namespace std; int square(int a){ return a*a; } struct Point{ int x,y; }; int distance (const Point& a,const Point& b){ int k=(int) sqrt((float)((a.x-b

What's this C# “using” directive?

流过昼夜 提交于 2019-11-30 07:25:55
问题 I saw this C# using statement in a code example: using StringFormat=System.Drawing.StringFormat; What's that all about? 回答1: That's aliasing a typename to a shorter name. The same syntax can also be used for aliasing namespaces. See using directive. (Updated in response to Richard) 回答2: It's an alias , from now on, the user can use StringFormat to refer to System.Drawing.StringFormat . It's useful if you don't want to use the whole namespace (in case of name clash issues for example). source:

where to put using namespace std;

落爺英雄遲暮 提交于 2019-11-29 17:33:36
问题 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 it make any difference where I put it? 回答1: It makes a huge difference where you put it. If you put it inside a function, then it only applies in that function. If you put it outside a function in global scope then it applies to everything after that point. If you put it outside a function in global

Is a using-directive in a detail namespace problematic?

家住魔仙堡 提交于 2019-11-29 14:21:43
Consider this library header: #include<vector> #include<algorithm> #include<iostream> namespace Lib { namespace detail { using namespace std; template<class T> void sort_impl(istream &in,ostream &out) { vector<T> v; { int n; in >> n; v.resize(n); } for(auto &i : v) cin >> i; sort(v.begin(),v.end()); for(auto i : v) out << i << endl; } } inline void sort_std() { detail::sort_impl<int>(std::cin,std::cout); } } Does the detail namespace successfully isolate the clients of the library (and the rest of library's implementation) from the using-directive in this example? I'm not interested in the