Description
- OS and Version: Windows 10
- VS Code Version: 1.40.1
- C/C++ Extension Version: 0.26.2-insiders
I have a codebase I'm writing right now where template implementation code is split up into .inl files (also typically used for inline/constexpr functions). While they're mainly just to keep header files "clean", I was thinking it would be nice to be able to swap to them from the header files themselves via the Switch Header/Source command.
I can see it either being implemented as swapping between 3 files with the same name if they exist (h/hpp,cpp,inl), or favoring just the header/source file swap if the source file exists, and header/inline file if an inl exists,
typical pattern:
(with all 3 files, a lot of cases could be just .hpp/.inl)
InlTest.hpp
#ifndef INL_TEST_H
#define INL_TEST_H
struct InlTest
{
void foo(const int& inFoo);
template <typename T>
void bar(const T& inBar);
};
#include "InlTest.inl"
#endif // INL_TEST_H
InlTest.cpp
#include "inlTest.hpp"
void InlTest::foo(const int& inFoo);
{
std::cout << inFoo << std::endl;
}
InlTest.inl
#include "inlTest.hpp" // Actually not needed, but helps with intellisense sometimes
#include <iostream>
template <typename T>
void InlTest::bar(const T& inBar);
{
std::cout << inBar << std::endl;
}
Out of the file types supported by the builtin C/C++ extension, the following could also be candidates for this toggle too:
.i .ii .ino .inl .ipp .hpp.in .h.in