• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

C++ Equivalent to VB SortedDictionary

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

VB C++
Imports System.Collections.Generic

Sub SortedDictionaries()
    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
#include <string>
#include <map>

void SortedDictionaries()
{
    std::map<std::wstring, int> map;
    std::wstring s = L"test";
    map.emplace(s, 1);
    int i = map[s];
    i = map.size();
    bool b = map.empty();
    map.erase(s);
}


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

Additional resource: VB.NET and C++ Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.