Iter

Table of Contents

Iter

Description

Memory iterators are there to allow reading regions of memory by remembering current read position and the size limit. With proper checking we can guarantee that we can never overflow or underflow when reading a memory region This also means that Iter objects are created for use with only one reading operation, and one object in their lifetime. The designed API does not allow modifications to the data Iter is iterating over FIELDS: - data : Pointer to memory we’re iterating over - length : Number of objects in memory. - pos : Current iterating position. - size : Alignment requirements (if-any), must be at-least 1 - dir : Iteration direction, -1 or 1

Usage example (Cross-references)

    #include <Misra/Std/Utility/Iter.h>
    #include <Misra/Std/Log.h>
    #define MISRA_STD_UILITY_H
    
    #include <Misra/Std/Utility/Iter.h>
    #include <Misra/Std/Utility/Pair.h>
    #include <Misra/Std/Utility/StrIter.h>
    
    // clang-format off
    #include "Iter/Type.h"
    #include "Iter/Init.h"
    #include "Iter/Access.h"
    // clang-format off
    #include "Iter/Type.h"
    #include "Iter/Init.h"
    #include "Iter/Access.h"
    #include "Iter/Move.h"
    #include "Iter/Type.h"
    #include "Iter/Init.h"
    #include "Iter/Access.h"
    #include "Iter/Move.h"
    // clang-format on
    #include "Iter/Init.h"
    #include "Iter/Access.h"
    #include "Iter/Move.h"
    // clang-format on
    
    #include <Misra/Std/Container/Vec/Type.h>
    #include <Misra/Std/Utility/Iter.h>
    #include <Misra/Types.h>
    #include <Misra/Types.h>
    
    typedef Iter(char) StrIter;
    typedef Vec(StrIter) StrIters;
    #define MISRA_STD_CONTAINER_VEC_ACCESS_H
    
    #include <Misra/Std/Utility/Iter.h>
    
    #include "Type.h"
    #include <string.h>
    #include <Misra/Std/Container/Vec/Type.h>
    #include <Misra/Std/Utility/Iter/Type.h>
    #include <Misra/Types.h>

Share :

Related Posts

ALIGN_UP

ALIGN_UP Description Aligns the given value up to the nearest multiple of alignment.

Read More

MemCompare

MemCompare Description Compare memory regions.

Read More

NEW

NEW Description Allocates zero-initialized memory for a type.

Read More