Q:

stl:map Error when insert value

sockets map def:
map<unsigned char[6],RawSocket> sockets_;

set value to the sockets map:
RawSocket tmp(ifcName,newSocketsIt->src_mac_);
sockets_[newSocketsIt->src_mac_] = tmp;

RawSocket def:
class RawSocket{
public:
    RawSocket(string ifcName,const unsigned char dstMac[6]);
}

I dont want to have default constructor for RawSocket.
error is:
/usr/include/c++/4.6/bits/stl_map.h: In member function ‘std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = unsigned char [6], _Tp = RawSocket, _Compare = std::less<unsigned char [6]>, _Alloc = std::allocator<std::pair<const unsigned char [6], RawSocket> >, std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = RawSocket, std::map<_Key, _Tp, _Compare, _Alloc>::key_type = unsigned char [6]]’:
../sockets_container.cpp:18:34:   instantiated from here
/usr/include/c++/4.6/bits/stl_map.h:453:11: error: no matching function for call to ‘RawSocket::RawSocket()’
/usr/include/c++/4.6/bits/stl_map.h:453:11: note: candidates are:
/root/workspace/networkutils/src/raw_socket.h:23:2: note: RawSocket::RawSocket(std::string, const unsigned char*)
/root/workspace/networkutils/src/raw_socket.h:23:2: note:   candidate expects 2 arguments, 0 provided
/root/workspace/networkutils/src/raw_socket.h:21:7: note: constexpr RawSocket::RawSocket(const RawSocket&)
/root/workspace/networkutils/src/raw_socket.h:21:7: note:   candidate expects 1 argument, 0 provided
/root/workspace/networkutils/src/raw_socket.h:21:7: note: constexpr RawSocket::RawSocket(RawSocket&&)
/root/workspace/networkutils/src/raw_socket.h:21:7: note:   candidate expects 1 argument, 0 provided

insert like this :
sockets_.insert(pair<unsigned char[6],RawSocket>(newSocketsIt->src_mac_,tmp));

will failed with this error:
/usr/include/c++/4.6/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(const _T1&, _U2&&) [with _U2 = RawSocket&, <template-parameter-2-2> = void, _T1 = unsigned char [6], _T2 = RawSocket]’:
../sockets_container.cpp:19:78:   instantiated from here
/usr/include/c++/4.6/bits/stl_pair.h:126:45: error: array used as initializer
/usr/include/c++/4.6/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(std::pair<_U1, _U2>&&) [with _U1 = unsigned char [6], _U2 = RawSocket, _T1 = const unsigned char [6], _T2 = RawSocket]’:
/usr/include/c++/4.6/bits/stl_tree.h:139:49:   instantiated from ‘std::_Rb_tree_node<_Val>::_Rb_tree_node(_Args&& ...) [with _Args = {std::pair<unsigned char [6], RawSocket>}, _Val = std::pair<const unsigned char [6], RawSocket>]’
/usr/include/c++/4.6/ext/new_allocator.h:114:4:   instantiated from ‘void __gnu_cxx::new_allocator<_Tp>::construct(__gnu_cxx::new_allocator<_Tp>::pointer, _Args&& ...) [with _Args = {std::pair<unsigned char [6], RawSocket>}, _Tp = std::_Rb_tree_node<std::pair<const unsigned char [6], RawSocket> >, __gnu_cxx::new_allocator<_Tp>::pointer = std::_Rb_tree_node<std::pair<const unsigned char [6], RawSocket> >*]’
/usr/include/c++/4.6/bits/stl_tree.h:405:8:   instantiated from ‘std::_Rb_tree_node<_Val>* std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {std::pair<unsigned char [6], RawSocket>}, _Key = unsigned char [6], _Val = std::pair<const unsigned char [6], RawSocket>, _KeyOfValue = std::_Select1st<std::pair<const unsigned char [6], RawSocket> >, _Compare = std::less<unsigned char [6]>, _Alloc = std::allocator<std::pair<const unsigned char [6], RawSocket> >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Link_type = std::_Rb_tree_node<std::pair<const unsigned char [6], RawSocket> >*]’
/usr/include/c++/4.6/bits/stl_tree.h:971:66:   instantiated from ‘std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Base_ptr, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Base_ptr, _Arg&&) [with _Arg = std::pair<unsigned char [6], RawSocket>, _Key = unsigned char [6], _Val = std::pair<const unsigned char [6], RawSocket>, _KeyOfValue = std::_Select1st<std::pair<const unsigned char [6], RawSocket> >, _Compare = std::less<unsigned char [6]>, _Alloc = std::allocator<std::pair<const unsigned char [6], RawSocket> >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator = std::_Rb_tree_iterator<std::pair<const unsigned char [6], RawSocket> >, std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_Const_Base_ptr = const std::_Rb_tree_node_base*]’
/usr/include/c++/4.6/bits/stl_tree.h:1285:64:   instantiated from ‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = std::pair<unsigned char [6], RawSocket>, _Key = unsigned char [6], _Val = std::pair<const unsigned char [6], RawSocket>, _KeyOfValue = std::_Select1st<std::pair<const unsigned char [6], RawSocket> >, _Compare = std::less<unsigned char [6]>, _Alloc = std::allocator<std::pair<const unsigned char [6], RawSocket> >]’
/usr/include/c++/4.6/bits/stl_map.h:526:64:   instantiated from ‘std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::map<_Key, _Tp, _Compare, _Alloc>::value_type>::other>::iterator, bool> std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = std::pair<unsigned char [6], RawSocket>, <template-parameter-2-2> = void, _Key = unsigned char [6], _Tp = RawSocket, _Compare = std::less<unsigned char [6]>, _Alloc = std::allocator<std::pair<const unsigned char [6], RawSocket> >, typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename _Alloc::rebind<std::map<_Key, _Tp, _Compare, _Alloc>::value_type>::other>::iterator = std::_Rb_tree_iterator<std::pair<const unsigned char [6], RawSocket> >]’
../sockets_container.cpp:19:79:   instantiated from here
/usr/include/c++/4.6/bits/stl_pair.h:137:40: error: array used as initializer

A:

sockets_[newSocketsIt->src_mac_] = tmp;

map's operator[] is trying to default construct an element with that key, because it isn't in the map yet. It would then assign tmp to it via operator=. You'll either need to provide default constructor for RawSocket or use std::map::insert() instead;
You're getting an error with insert because unsigned[6] and src_mac_ are both array types and you can't initialize an array with another array (this happens when you're making std::pair). Consider switching to a container like std::array or std::vector or wrap the array in your own struct and use that as key.
Quick workaround would be:
struct Arr6 {
    unsigned char array[6];
};

std::map <Arr6, RawSocket> sockets_;

Change the definiton of src_mac_ to be Arr6, too.

