Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
486 B
2
Indexable
Never
#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);
	
}