| | |
Can Templates Have prototypes ?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
C Syntax (Toggle Plain Text)
template< typename T > inline void swap( T& a, T& b ) ; // declaration (function) template< typename T, size_t N > struct array ; // declaration (class) // definition of function template< typename T > void swap( T& a, T& b ) { T temp(a) ; a=b ; b=temp ; } // definition of class template< typename T, size_t N > struct array { T& operator[] ( size_t i ) { if( i >= N ) throw "array bound exceeded!" ; return a[i] ; } const T& operator[] ( size_t i ) const { if( i >= N ) throw "array bound exceeded!" ; return a[i] ; } private: T a[N] ; };
![]() |
Similar Threads
- Free High Quality Website & Logo Templates (Post your Resume)
- Great Place for free templates and other resources. (Site Layout and Usability)
- More psd templates (Website Reviews)
- RTC Templates - Talented designers required (Software Development Job Offers)
- Templates (Websites for Sale)
- C++ Templates (C++)
Other Threads in the C Forum
- Previous Thread: Frequency Counter
- Next Thread: Hospital Record.. double array.. help
| Thread Tools | Search this Thread |
adobe api array arrays bash binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators initialization intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue multi mysql oddnumber odf open opendocumentformat opensource openwebfoundation pattern pdf performance pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition scanf scheduling scripting segmentationfault send shape socketprograming socketprogramming stack standard strchr string strings suggestions test testautomation unix urboc user variable voidmain() win32api windows.h






