проблема в том, что всякий раз, когда я что-то пишу в терминале, особенно когда я ввожу пробел, код останавливается после return 0; в main(). После этого на моей вкладке откроется новый файл с именем 'new_allocater.h'. Кроме того, сообщение об ошибке вообще не появляется, код останавливается внутри 'new_allocater.h', как если бы была точка останова.
Пока это не похоже на проблема на самом деле мешает запуску моего кода, поскольку проблема появляется после return 0; в main(). Но в будущем он определенно аукнется мне.
Вот код моего проекта калькулятора:
Код: Выделить всё
#include
#include
#include
#include
#include
#include
using namespace std;
vector split(string s, const char f) { // s = string, f = delimiter
// Function for turning strings into vectors using a delimiter
vector v; // List of substrings to be returned
int startPoint = 0; // Startpos of substring
const int stringLength = s.length();
for (int i = 0; i < stringLength; i++)
{
if (s[i] == f) {
s.erase(i, 1); // Remove delimiter character from the string
v.push_back(s.substr(startPoint, i-startPoint));
startPoint = i;
}
}
v.push_back(s.substr(startPoint, s.back()));
return v;
}
bool isDigit(const string &s) {
// Return true or false value whether a string is a digit or not
return s.find_first_not_of("0123456789.") == string::npos;
}
double convertMainToAlt(string s) {
const int stringLength = s.length();
for (int i = 0; i < stringLength; i++)
{
if (s[i] == '(' || s[i] == ')' || s[i] == 'V') {
s.erase(i, 1);
i--;
}
}
if (isDigit(s)) {
return stod(s);
}
else {
return 0;
}
}
int main()
{
// Main variables / vectors / arrays used for the program
string mainEquation; // String of equation
vector mainEquationList; // {"(5", "+", "10)", "-", "4.2"}
getline(cin, mainEquation); // Get user input for the equation
mainEquationList = split(mainEquation, ' ');
vector altEquationList = {{0}, {0}}; /*
{{equation numbers}, {layer numbers}}*/
for (int i = 0; i < mainEquationList.size(); i++)
{
altEquationList[0][i] = convertMainToAlt(mainEquationList[i]);
}
for (int i = 0; i < mainEquationList.size(); i++)
{
cout __STDCPP_DEFAULT_NEW_ALIGNMENT__)
{
_GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n),
std::align_val_t(alignof(_Tp)));
return;
}
#endif
_GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n)); // Line 168, the error occurs here
}
#undef _GLIBCXX_SIZED_DEALLOC
#undef _GLIBCXX_OPERATOR_DELETE
#undef _GLIBCXX_OPERATOR_NEW
#if __cplusplus = 201103L
template
__attribute__((__always_inline__))
void
construct(_Up* __p, _Args&&... __args)
noexcept(std::is_nothrow_constructible::value)
{ ::new((void *)__p) _Up(std::forward(__args)...); }
template
__attribute__((__always_inline__))
void
destroy(_Up* __p)
noexcept(std::is_nothrow_destructible::value)
{ __p->~_Up(); }
#else
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 402. wrong new expression in [some_] allocator::construct
__attribute__((__always_inline__))
void
construct(pointer __p, const _Tp& __val)
{ ::new((void *)__p) _Tp(__val); }
__attribute__((__always_inline__))
void
destroy(pointer __p) { __p->~_Tp(); }
#endif
#endif // ! C++20
template
friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR bool
operator==(const __new_allocator&, const __new_allocator&)
_GLIBCXX_NOTHROW
{ return true; }
#if __cpp_impl_three_way_comparison < 201907L
template
friend __attribute__((__always_inline__)) _GLIBCXX20_CONSTEXPR bool
operator!=(const __new_allocator&, const __new_allocator&)
_GLIBCXX_NOTHROW
{ return false; }
#endif
private:
__attribute__((__always_inline__))
_GLIBCXX_CONSTEXPR size_type
_M_max_size() const _GLIBCXX_USE_NOEXCEPT
{
#if __PTRDIFF_MAX__ < __SIZE_MAX__
return std::size_t(__PTRDIFF_MAX__) / sizeof(_Tp);
#else
return std::size_t(-1) / sizeof(_Tp);
#endif
}
};
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif

Подробнее здесь: https://stackoverflow.com/questions/781 ... hats-wrong
Мобильная версия