Код: Выделить всё
int red[3] = {1,0,0};
int green[3] = {0,1,0};
int blue[3] = {0,0,1};
std::map colours;
colours.insert(std::pair(GLUT_LEFT_BUTTON,red)); // THIS IS LINE 24!
colours.insert(std::pair(GLUT_MIDDLE_BUTTON,blue));
colours.insert(std::pair(GLUT_RIGHT_BUTTON,green));
Код: Выделить всё
g++ (Ubuntu 4.4.1-4ubuntu8) 4.4.1
In file included from /usr/include/c++/4.4/bits/stl_algobase.h:66,
from /usr/include/c++/4.4/bits/stl_tree.h:62,
from /usr/include/c++/4.4/map:60,
from ../src/utils.cpp:9:
/usr/include/c++/4.4/bits/stl_pair.h: In constructor ‘std::pair::pair(const _T1&, const _T2&) [with _T1 = int, _T2 = int [3]]’:
../src/utils.cpp:24: instantiated from here
/usr/include/c++/4.4/bits/stl_pair.h:84: error: array used as initializer
/usr/include/c++/4.4/bits/stl_pair.h: In constructor ‘std::pair::pair(const std::pair&) [with _U1 = int, _U2 = int [3], _T1 = const int, _T2 = int [3]]’:
../src/utils.cpp:24: instantiated from here
/usr/include/c++/4.4/bits/stl_pair.h:101: error: array used as initializer
In file included from /usr/include/c++/4.4/map:61,
from ../src/utils.cpp:9:
/usr/include/c++/4.4/bits/stl_map.h: In member function ‘_Tp& std::map::operator[](const _Key&) [with _Key = int, _Tp = int [3], _Compare = std::less, _Alloc = std::allocator]’:
../src/utils.cpp:30: instantiated from here
/usr/include/c++/4.4/bits/stl_map.h:450: error: conversion from ‘int’ to non-scalar type ‘int [3]’ requested
make: *** [src/utils.o] Error 1
Подробнее здесь: https://stackoverflow.com/questions/258 ... -map-value