Untitled
unknown
c_cpp
3 years ago
486 B
10
Indexable
#include <vector>
#include <ranges>
#include <iostream>
#include <map>
template <std::ranges::range R>
void prntOut(R&& a)
{
std::cout << "klucz: | ";
for (std::string const& key : std::views::keys(a))
std::cout << key << " | ";
std::cout<< std::endl << "wartosc: | ";
for (const double value : std::views::values(a))
std::cout << value << " | ";
}
int main(){
std::map<std::string, int> m{ {"RAZ", 11}, {"DWA", 22}, {"TRZY", 33}, };
prntOut(m);
}Editor is loading...