Skip to content

Instantly share code, notes, and snippets.

@andr1972
Last active March 5, 2022 08:38
Show Gist options
  • Save andr1972/96887fcf43912151b81db0443c3fef24 to your computer and use it in GitHub Desktop.
Save andr1972/96887fcf43912151b81db0443c3fef24 to your computer and use it in GitHub Desktop.
MInimal example of confiusion std::remove with remove from stdio.h
cmake_minimum_required(VERSION 3.7)
project(minimal_std)
set(CMAKE_CXX_STANDARD 11)
set(wxWidgets_ROOT_DIR /usr/include/wx-3.0)
find_package(wxWidgets COMPONENTS core base net REQUIRED)
include(${wxWidgets_USE_FILE})
add_definitions("-Werror=return-type -H")
set(SOURCE_FILES main.cpp main.h)
add_executable(minimal_std ${SOURCE_FILES})
target_link_libraries(minimal_std ${wxWidgets_LIBRARIES})
#include "main.h"
#include <wx/filename.h>
#include <vector>
#include <string>
wxIMPLEMENT_APP(MyApp);
MyFrame *mainFrame;
bool MyApp::OnInit() {
MyFrame *frame = new MyFrame(NULL, wxID_ANY, "minimal_std", wxDefaultPosition, wxSize(800,600), wxDEFAULT_FRAME_STYLE);;
frame->Show(true);
mainFrame = frame;
return true;
}
MyFrame::MyFrame(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size, long style)
: wxFrame(parent, id, title, pos, size, style) {
std::vector<std::string> m_connections;
//line below is problem, comment it to build
m_connections.erase(std::remove(m_connections.begin(), m_connections.end(), nullptr), m_connections.end());
}
#ifndef MINIMAL_STD_MAIN_H
#define MINIMAL_STD_MAIN_H
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame : public wxFrame
{
public:
MyFrame(wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size, long style);
};
#endif //MINIMAL_STD_MAIN_H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment