Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:18

0001 // name=SNameOrder_test ; gcc $name.cc -std=c++11 -lstdc++ -I.. -o /tmp/$name && /tmp/$name
0002 
0003 #include <string>
0004 
0005 struct Demo
0006 {
0007     std::string name ; 
0008     Demo(const char* name); 
0009     const std::string& GetName() const ; 
0010 }; 
0011 
0012 inline Demo::Demo(const char* name_)
0013     :
0014     name(name_)
0015 {
0016 }
0017 inline const std::string& Demo::GetName() const 
0018 {
0019     return name ; 
0020 }
0021 
0022 #include "SNameOrder.h"
0023 
0024 
0025 
0026 int main(int argc, char** argv)
0027 {
0028     std::vector<Demo*> dd ; 
0029     dd.push_back( new Demo("Red0xc0ffee") ) ;
0030     dd.push_back( new Demo("Green0xc0ffee") );
0031     dd.push_back( new Demo("Blue0xc0ffee") ) ;
0032  
0033     std::cout << SNameOrder<Demo>::Desc(dd) << std::endl ;  
0034 
0035     SNameOrder<Demo>::Sort(dd) ; 
0036 
0037     std::cout << SNameOrder<Demo>::Desc(dd) << std::endl ;  
0038 
0039 
0040     return 0 ; 
0041 
0042 }