mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 15:26:04 +00:00
Better comments for understanding the classes array_t<> and array_item_t<>
This commit is contained in:
parent
8a0a18a527
commit
cb1b6bc9ae
@ -35,9 +35,16 @@
|
|||||||
|
|
||||||
namespace zmq
|
namespace zmq
|
||||||
{
|
{
|
||||||
|
// Implementation of fast arrays with O(1) access, insertion and
|
||||||
|
// removal. The array stores pointers rather than objects.
|
||||||
|
// O(1) is achieved by making items inheriting from
|
||||||
|
// array_item_t<ID> class which internally stores the position
|
||||||
|
// in the array.
|
||||||
|
// The ID template argument is used to differentiate among arrays
|
||||||
|
// and thus let an object be stored in different arrays.
|
||||||
|
|
||||||
// Base class for objects stored in the array. If you want to store
|
// Base class for objects stored in the array. If you want to store
|
||||||
// same object in mutliple arrays, each of those arrays has to have
|
// same object in multiple arrays, each of those arrays has to have
|
||||||
// different ID. The item itself has to be derived from instantiations of
|
// different ID. The item itself has to be derived from instantiations of
|
||||||
// array_item_t template for all relevant IDs.
|
// array_item_t template for all relevant IDs.
|
||||||
|
|
||||||
@ -74,9 +81,6 @@ namespace zmq
|
|||||||
const array_item_t &operator = (const array_item_t&);
|
const array_item_t &operator = (const array_item_t&);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fast array implementation with O(1) access to item, insertion and
|
|
||||||
// removal. Array stores pointers rather than objects. The objects have
|
|
||||||
// to be derived from array_item_t<ID> class.
|
|
||||||
|
|
||||||
template <typename T, int ID = 0> class array_t
|
template <typename T, int ID = 0> class array_t
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ namespace zmq
|
|||||||
|
|
||||||
// Note that pipe can be stored in three different arrays.
|
// Note that pipe can be stored in three different arrays.
|
||||||
// The array of inbound pipes (1), the array of outbound pipes (2) and
|
// The array of inbound pipes (1), the array of outbound pipes (2) and
|
||||||
// the generic array of pipes to deallocate (3).
|
// the generic array of pipes to be deallocated (3).
|
||||||
|
|
||||||
class pipe_t :
|
class pipe_t :
|
||||||
public object_t,
|
public object_t,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user