Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[doc] Suggest C++ alternatives to xbt containers
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 12 Jul 2016 13:05:15 +0000 (15:05 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 12 Jul 2016 13:05:15 +0000 (15:05 +0200)
doc/doxygen/module-xbt.doc
include/xbt/dict.h
include/xbt/dynar.h
include/xbt/fifo.h
include/xbt/heap.h
include/xbt/swag.h

index ee62c0a..ef58360 100644 (file)
@@ -64,6 +64,8 @@
 
   Here are the basic data containers that every C programmer rewrites one day.
   You won't need to do so yourself, you lucky one, because we did it for you.
 
   Here are the basic data containers that every C programmer rewrites one day.
   You won't need to do so yourself, you lucky one, because we did it for you.
+  However, if you are programming in C++ you might want to use C++ containers
+  instead.
 
   @{ */
      /** @defgroup XBT_dynar  Dynar: generic dynamic array */
 
   @{ */
      /** @defgroup XBT_dynar  Dynar: generic dynamic array */
index 87c70ec..b3cfd35 100644 (file)
@@ -21,6 +21,8 @@ SG_BEGIN_DECL()
  *  This section describes the API to a dictionary structure that  associates as string to a void* key. It provides the
  *  same functionality than an hash table.
  *
  *  This section describes the API to a dictionary structure that  associates as string to a void* key. It provides the
  *  same functionality than an hash table.
  *
+ *  If you are using C++, you might want to use `std::unordered_map` instead.
+ *
  *  Here is a little example of use:
 
 \verbatim
  *  Here is a little example of use:
 
 \verbatim
@@ -33,7 +35,6 @@ SG_BEGIN_DECL()
  sprintf(buff,"another good stuff");
  xbt_dict_set(mydict,"my data", strdup(buff), free); // previous data gets erased (and freed) by second add
 \endverbatim
  sprintf(buff,"another good stuff");
  xbt_dict_set(mydict,"my data", strdup(buff), free); // previous data gets erased (and freed) by second add
 \endverbatim
- *
  */
 
 /** @defgroup XBT_dict_cons Dict constructor and destructor
  */
 
 /** @defgroup XBT_dict_cons Dict constructor and destructor
index b8cfbdd..874eb46 100644 (file)
@@ -25,6 +25,8 @@ SG_BEGIN_DECL()
   * \ref XBT_dict section). You thus have to provide the function which will be used to free the content at
   * structure creation (of type void_f_ppvoid_t or void_f_pvoid_t).
   *
   * \ref XBT_dict section). You thus have to provide the function which will be used to free the content at
   * structure creation (of type void_f_ppvoid_t or void_f_pvoid_t).
   *
+  *  If you are using C++, you might want to use `std::vector` instead.
+  *
   * \section XBT_dynar_exscal Example with scalar
   * \dontinclude dynar.cpp
   *
   * \section XBT_dynar_exscal Example with scalar
   * \dontinclude dynar.cpp
   *
index c373926..5f6432b 100644 (file)
@@ -14,9 +14,13 @@ SG_BEGIN_DECL()
 /** @addtogroup XBT_fifo
  *  @brief This section describes the API to generic workqueue.
  *
 /** @addtogroup XBT_fifo
  *  @brief This section describes the API to generic workqueue.
  *
- * These functions provide the same kind of functionality as dynamic arrays but in time O(1).
- * However these functions use malloc/free way too much often.
+ * These functions provide the same kind of functionality as dynamic arrays
+ * but in time O(1). However these functions use malloc/free way too much often.
+ *
+ *  If you are using C++, you might want to used std::list, std::deque or
+ *  std::queue instead.
  */
  */
 /** @defgroup XBT_fifo_cons Fifo constructor and destructor
  *  @ingroup XBT_fifo
  *
 /** @defgroup XBT_fifo_cons Fifo constructor and destructor
  *  @ingroup XBT_fifo
  *
index ddf76dd..3fe2951 100644 (file)
@@ -15,6 +15,8 @@ SG_BEGIN_DECL()
 /** @addtogroup XBT_heap
  *  @brief This section describes the API to generic heap with O(log(n)) access.
  *
 /** @addtogroup XBT_heap
  *  @brief This section describes the API to generic heap with O(log(n)) access.
  *
+ *  If you are using C++ you might want to use std::priority_queue instead.
+ *
  *  @{
  */
 /* @brief heap datatype */
  *  @{
  */
 /* @brief heap datatype */
index ecbdb15..318be64 100644 (file)
@@ -24,6 +24,7 @@ SG_BEGIN_DECL()
  *  It is basically a fifo but with restrictions so that it can be used as a set. Any operation (add, remove, belongs)
  *  is O(1) and no call to malloc/free is done.
  *
  *  It is basically a fifo but with restrictions so that it can be used as a set. Any operation (add, remove, belongs)
  *  is O(1) and no call to malloc/free is done.
  *
+ *  If you are using C++, you might want to use boost::intrusive::set instead.
  */
 /** @defgroup XBT_swag_type Swag types
     @ingroup XBT_swag
  */
 /** @defgroup XBT_swag_type Swag types
     @ingroup XBT_swag