Menu

Welcome to Open Discussion

2006-03-06
2013-04-25
  • Nobody/Anonymous

    Welcome to Open Discussion

     
    • North

      North - 2006-03-21

      Din moment ce vom face teste cu mai multe tipuri de date se intelege necesitatea crearii sortarii pe respectivele tipuri de date. Avem 2 variante:
      1. Supraincarcarea functiilor - se pare ca se merge pe ideea asta.
      2. Creare de functie generica cu prototipul:
      void ???sort(void *array, int dimension, short int type);
      unde tipul va avea constante predefinite{CHAR, INT , DOUBLE, *CHAR ....}
      La o prima analiza se pare ca supraincarcarea pare mai lejer de realizat si pe care se merge.

       
      • Iulian Serbanoiu

        Anyway we could use the first approach ( using templates ) (1 says something like that )

        Or we could use the qsort model function:

        void  qsort(void  *base,  size_t  nel, size_t width, int (*compar)(const void *, const void *));

        from stdlib ( I think this will come handy ).

        Anyway we could use base classes / derived classes but first I think it is important to focus on the effective implementation which will be ok if we sort for example (for the moment) integers.

        Maybe others have different opinions and I'm curious to 'hear' them.

         

Log in to post a comment.