Wed 16 Apr 2014 01:48:58 AM UTC, original submission:
Trying to compile on OS X 10.9 with Xcode 5.1 fails with:
menu.cc:115:8: error: calling a private constructor of class 'std::__1::__wrap_iter<libmenu::Item *>'
IT it(&m_its[pos]);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:1220:31: note: declared private here
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
^
menu.cc:121:8: error: calling a private constructor of class 'std::__1::__wrap_iter<libmenu::Item *>'
IT it(&m_its[pos]);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:1220:31: note: declared private here
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
^
menu.cc:127:8: error: calling a private constructor of class 'std::__1::__wrap_iter<libmenu::Item *>'
IT it(&m_its[pos]);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/iterator:1220:31: note: declared private here
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
The following patch allows compilation to succeed:
diff --git a/src/menu.cc b/src/menu.cc
index 483b826..092d604 100644
--- a/src/menu.cc
+++ b/src/menu.cc
@@ -112,20 +112,17 @@ void Menu::add_item(id_type id, std::string c, Function2 f)
void Menu::add_item_at(unsigned int pos, id_type id, std::string c, Function1 f)
{
- IT it(&m_its[pos]);
- m_its.insert(it, Item(id,c,f) );
+ m_its.insert(m_its.begin()+pos, Item(id,c,f) );
}
void Menu::add_item_at(unsigned int pos, id_type id, std::string c, Function2 f)
{
- IT it(&m_its[pos]);
- m_its.insert(it, Item(id,c,f) );
+ m_its.insert(m_its.begin()+pos, Item(id,c,f) );
}
void Menu::delete_item_at(unsigned int pos)
{
- IT it(&m_its[pos]);
- m_its.erase(it);
+ m_its.erase(m_its.begin()+pos);
}
|