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

VB Equivalent to C++ std::map

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

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

void Map()
    std::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 Map()
    Dim map As New SortedDictionary(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.