Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Why does a C++ friend class need a forward declaration only in other namespaces? -


suppose have class f should friend classes g (in global namespace) , c (in namespace a).

  • to friend a::c, f must forward declared.
  • to friend g, no forward declaration of f necessary.
  • likewise, class a::bf can friend a::c without forward declaration

the following code illustrates , compiles gcc 4.5, vc++ 10 , @ least 1 other compiler.

class g {     friend class f;     int g; };  // without forward declaration, f can't friend a::c class f;  namespace {  class c {     friend class ::f;     friend class bf;     int c; };  class bf { public:     bf() { c.c = 2; } private:     c c; };  } // namespace  class f { public:     f() { g.g = 3; c.c = 2; } private:     g g;     a::c c; };  int main() {     f f; } 

to me seems inconsistent. there reason or design decision of standard?

c++ standard iso/iec 14882:2003(e)

7.3.1.2 namespace member definitions

paragraph 3

every name first declared in namespace a member of namespace. if friend declaration in non-local class first declares class or function (this implies name of class or function unqualified) friend class or function member of innermost enclosing namespace.

// assume f , g have not yet been defined. void h(int); template <class t> void f2(t); namespace {    class x {    friend void f(x);  //  a::f(x) friend       class y {          friend void g();  //  a::g friend          friend void h(int);  //  a::h friend          //  ::h not considered          friend void f2<>(int);  //  ::f2<>(int) friend       };    };    //  a::f, a::g , a::h not visible here    x x;    void g() { f(x); }  // definition of a::g    void f(x) { /* ... */}  // definition of a::f    void h(int) { /* ... */ }  // definition of a::h    //  a::f, a::g , a::h visible here , known friends } 

your friend class bf; declaration of a::bf in namespace rather global namespace. need global prior declaration avoid new declaration.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -