diff --git a/README.md b/README.md index 0f06df3d..aecf93ab 100644 --- a/README.md +++ b/README.md @@ -831,22 +831,23 @@ All bench codes are available in the bench directory. The results are available [in a separate page](https://github.com/P-p-H-d/mlib/wiki/performance). -Emplace -------- +Emplace construction +-------------------- For M\*LIB, 'emplace' means pushing a new object in the container, -while not giving it the new object, but the parameters needed +while not giving it a copy of the new object, but the parameters needed to construct this object. This is a shortcut to the pattern of creating the object with the arguments, pushing it in the container, and deleting the created object (even if using PUSH\_MOVE could simplify the design). -The containers taggued as emplace support generate the emplace functions -based on the provided EMPLACE\_TYPE of the oplist. If EMPLACE\_TYPE doesn't exist or is disabled, no emplace function is generated. Otherwise: +The containers defining an emplace like method generate the emplace functions +based on the provided EMPLACE\_TYPE of the oplist. If EMPLACE\_TYPE doesn't exist or is disabled, no emplace function is generated. Otherwise EMPLACE\_TYPE identifies +which types can be used to construct the object and which methods to use to construct then: * EMPLACE\_TYPE( typeA ) means that the object can be constructed from 'typeA' using the method of the INIT_WITH operator. An emplace function without suffix will be generated. * EMPLACE\_TYPE( (typeA, typeB, ...) ) means that the object can be constructed from the lists of types 'typeA, typeB, ...' using the method of the INIT_WITH operator. An emplace function without suffix will be generated. -* EMPLACE\_TYPE( LIST( (suffix, function, typeA, typeB, ...), (suffix, function, typeA, typeB, ...), ...) means that the object can be constructed from all the provided lists of types 'typeA, typeB, ...' using the provided method 'function'. The 'function' is the method to call to construct the object from the list of types. It supports API transformation if needed. As many emplace function will be generated as there are constructor function. Each generated function will be generated by suffixing it with the provided 'suffix'. +* EMPLACE\_TYPE( LIST( (suffix, function, typeA, typeB, ...), (suffix, function, typeA, typeB, ...), ...) means that the object can be constructed from all the provided lists of types 'typeA, typeB, ...' using the provided method 'function'. The 'function' is the method to call to construct the object from the list of types. It supports API transformation if needed. As many emplace function will be generated as there are constructor function. Each generated function will be generated by suffixing it with the provided 'suffix' (if suffix is empty, no suffix will be added). For example, for an ARRAY definition named vec, if there is such a definition of EMPLACE\_TYPE(const char *), it will generate a function vec_emplace_back(const char *). This function will take a const char * parameter, construct the object from it (for example a string\_t) then push the result back on the array. @@ -858,7 +859,7 @@ External Reference ------------------ Many other implementation of generic container libraries in C exist. -For example: +For example, a non exhaustive list is: * [BKTHOMPS/CONTAINERS](https://github.com/bkthomps/Containers) * [BSD tree.h](http://fxr.watson.org/fxr/source/sys/tree.h) @@ -903,7 +904,7 @@ M\*LIB main added value compared to other libraries is its oplist feature enabling it to chain the containers and/or use complex types in containers: list of array of dictionary of C++ objects are perfectly supported by M\*LIB. -For the macro-preprocessing part, other libraries also exist. For example: +For the macro-preprocessing part, other libraries and reference also exist. For example: * [Boost preprocessor](http://www.boost.org/doc/libs/1_63_0/libs/preprocessor/doc/index.html) * [C99 Lambda](https://github.com/Leushenko/C99-Lambda)