Вы можете установить cplexAPI вручную:
R CMD INSTALL --configure-args=" \
--with-cplex-include=/path/to/cplex_include/dir \
--with-cplex-lib=/path/to/cplex_lib/dir" cplexAPI_x.x.x.tar.gz
Здесь можно найти несколько других опций здесь . Вы также можете добавить Cplex / include и / lib в свой PATH, если используете GNU / Linux. Имейте в виду, что Cplex имеет каталоги cplex
(в основном для C) и concert
(для C ++), но похоже, что вам нужен только каталог cplex
.
В out
нет места. Алгоритмы C ++ не увеличивают свои целевые контейнеры автоматически. Вы должны либо освободить место самостоятельно, либо использовать адаптер для вставки.
Чтобы освободить место в out
, сделайте это:
out.resize(s.length());
[править] Другой вариант - создать выходную строку с правильным размером с помощью этого конструктора.
std::string out(s.length(), 'X');
I'd say that the iterator returned by out.begin()
is not valid after a couple of increments for the empty string. After the first ++
it's ==out.end()
, then the behavior after the next increment is undefined.
After all this exactly what insert iterator is for.
Thats the sense of a backinserter: It inserts elements to a container. using begin(), you pass a iterator to a empty container and modify invalid iterators.
I am sorry - my edits interfered with your comments. I first posted something wrong accidentally.