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.

c++ - What is the merit of the "function" type (not "pointer to function") -


reading c++ standard, see there "function" types , "pointer function" types:

typedef int func(int);     // function typedef int (*pfunc)(int); // pointer function typedef func* pfunc;       // same above 

i have never seen function types used outside of examples (or maybe didn't recognize usage?). examples:

func increase, decrease;            // declares 2 functions int increase(int), decrease(int);   // same above  int increase(int x) {return x + 1;} // cannot use typedef when defining functions int decrease(int x) {return x - 1;} // cannot use typedef when defining functions  struct mystruct {     func add, subtract, multiply;   // declares 3 member functions     int member; };  int mystruct::add(int x) {return x + member;} // cannot use typedef int mystruct::subtract(int x) {return x - member;}  int main() {     func k; // syntax correct variable k useless!     mystruct myobject;     myobject.member = 4;      cout << increase(5) << ' ' << decrease(5) << '\n'; // outputs 6 , 4     cout << myobject.add(5) << ' ' << myobject.subtract(5) << '\n'; // 9 , 1 } 

seeing function types support syntax doesn't appear in c (declaring member functions), guess not part of c baggage c++ has support backward compatibility.

so there use function types, other demonstrating funky syntax?

an example of why useful boost, see lot. example in signals2 library:

boost::signals2::signal<void (int, int)> mysignal; 

where above declares signal accept function takes 2 ints , has void return type.


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 -