• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 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();
    map.erase(s);
}
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
    map.Remove(s)
End Sub


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

Additional resource: VB.NET and C++ Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.