• Saves Valuable Time
  • Trusted Accuracy since 2004
  • 15-Day Money-Back Guarantee

VB Equivalent to C++ std::unordered_map

The nearly exact VB equivalent to the C++ std::unordered_map collection is the .NET Dictionary collection. (The VB equivalent to the C++ std::map collection is the .NET SortedDictionary collection).

C++ VB
#include <string>
#include <unordered_map>

void UnorderedMap()
    std::unordered_map<std::wstring, int> map;
    std::wstring s = L"test";
    map.insert(std::make_pair(s, 1));
    int i = map[s];
    i = map.size();
    bool b = map.empty();
Imports System.Collections.Generic

Sub UnorderedMap()
    Dim map As New Dictionary(Of String, Integer)()
    Dim s As String = "test"
    map.Add(s, 1)
    Dim i As Integer = map(s)
    i = map.Count
    Dim b As Boolean = map.Count = 0
End Sub

Use C++ to VB Converter to convert from C++ to VB.     

Additional resource: VB.NET and C++ Equivalents

Copyright © 2004 – 2021 Tangible Software Solutions, Inc.