[#CoinsViewCacheCursor]
= CoinsViewCacheCursor
:mrdocs:

Cursor for iterating over the linked list of flagged entries in CCoinsViewCache&period;

== Synopsis

Declared in `&lt;coins&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
struct CoinsViewCacheCursor;
----

== Description

This is a helper struct to encapsulate the diverging logic between a non&hyphen;erasing CCoinsViewCache&colon;&colon;Sync and an erasing CCoinsViewCache&colon;&colon;Flush&period; This allows the receiver of CCoinsView&colon;&colon;BatchWrite to iterate through the flagged entries without knowing the caller&apos;s intent&period;

However, the receiver can still call CoinsViewCacheCursor&colon;&colon;WillErase to see if the caller will erase the entry after BatchWrite returns&period; If so, the receiver can perform optimizations such as moving the coin out of the CCoinsCachEntry instead of copying it&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CoinsViewCacheCursor/2constructor.adoc[`CoinsViewCacheCursor`]         [.small]#[constructor]#
| If will&lowbar;erase is not set, iterating through the cursor will erase spent coins from the map, and other coins will be unflagged (removing them from the linked list)&period; If will&lowbar;erase is set, the underlying map and linked list will not be modified, as the caller is expected to wipe the entire map anyway&period; This is an optimization compared to erasing all entries as the cursor iterates them when will&lowbar;erase is set&period; Calling CCoinsMap&colon;&colon;clear() afterwards is faster because a CoinsCachePair cannot be coerced back into a CCoinsMap&colon;&colon;iterator to be erased, and must therefore be looked up again by key in the CCoinsMap before being erased&period;
| xref:CoinsViewCacheCursor/Begin.adoc[`Begin`] 
| Get the first flagged entry in the linked list&period;
| xref:CoinsViewCacheCursor/End.adoc[`End`] 
| Get the one&hyphen;past&hyphen;the&hyphen;end sentinel of the linked list&period;
| xref:CoinsViewCacheCursor/GetDirtyCount.adoc[`GetDirtyCount`] 
| Report the number of dirty entries remaining to iterate&period;
| xref:CoinsViewCacheCursor/GetTotalCount.adoc[`GetTotalCount`] 
| Report the total number of entries in the underlying map&period;
| xref:CoinsViewCacheCursor/NextAndMaybeErase.adoc[`NextAndMaybeErase`] 
| Return the next entry after current, possibly erasing current
| xref:CoinsViewCacheCursor/WillErase.adoc[`WillErase`] 
| Report whether the given entry will be erased after BatchWrite returns&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
