first, make the C++ library accessible to Python (already done, in many cases), then, let your Haskell program use the Python interpreter to make calls into the C++ library
Тег c++
Сотрудник попросил объяснить смысл ворнинга ("переменная затеняет член класса"), в результате нашли баг с синхронизацией
{
scoped_lock(m_mutex);
do_some_with_shared_data();
}
inb4: fix
{
scoped_lock lock(m_mutex);
do_some_with_shared_data();
}
auto list = [](auto ...xs) {
return [=](auto access) { return access(xs...); };
};
auto head = [](auto xs) {
return xs([](auto first, auto ...rest) { return first; });
};
auto tail = [](auto xs) {
return xs([](auto first, auto ...rest) { return list(rest...); });
};
auto length = [](auto xs) {
return xs([](auto ...z) { return sizeof...(z); });
};
int len = length(list(1, '2', "3")); // 3
я правильно понимаю, что для unordered_set<std::pair<T1,T2>>, где T1 и T2 - типы из плюсцов вроде int/uint/string/something else не определена функция хеширования? Если да, то доколе (будет ли добавлено в 14/17)?
В бусте можно делать так
typedef std::pair<uint, uint> my_pair;
typedef boost::multi_index_container<
my_pair,
boost::multi_index::indexed_by<
boost::multi_index::hashed_unique<boost::multi_index::identity<my_pair> >,
boost::multi_index::hashed_non_unique<boost::multi_index::member<my_pair, uint, &my_pair::first> >
>
> pair_set;
и всё работает
http://gliv.livejournal.com/127125.html видео для быдла, не читающего стандарт (для меня)
Довольно интересный опыт - после 4 месяцев упорного цодинга (голова забавно шкварчала, кстати, поначалу) на скале и попыток заработать ФП мозга, вернуться на плюсы.