Skip to content

Instantly share code, notes, and snippets.

@loskutov
Created October 31, 2018 16:02
Show Gist options
  • Save loskutov/da66fed5de1a4923078efa20ad12ee8b to your computer and use it in GitHub Desktop.
Save loskutov/da66fed5de1a4923078efa20ad12ee8b to your computer and use it in GitHub Desktop.
A simple project where IWYU fails
#include "container.h"
IMPLEMENTATION_DEFINED_CONTAINER_TYPE container;
#pragma once
// IMPLEMENTATION_DEFINED_CONTAINER_TYPE is guaranteed to fulfill some concept
// (say, SequenceContainer<int>)
#ifdef USE_DEQUE
#include <deque>
using IMPLEMENTATION_DEFINED_CONTAINER_TYPE = std::deque<int>;
#else
#include <vector>
using IMPLEMENTATION_DEFINED_CONTAINER_TYPE = std::vector<int>;
#endif
extern IMPLEMENTATION_DEFINED_CONTAINER_TYPE container;
#include "container.h"
#include <iostream>
int main() {
container.push_back(5);
auto it = container.begin();
std::cout << *it;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment