[C++] Detect CodeLite parser in code?

General questions regarding the usage of CodeLite
lifepower
CodeLite Enthusiast
Posts: 16
Joined: Sat Apr 23, 2016 9:37 pm
Genuine User: Yes
IDE Question: C++
Contact:

[C++] Detect CodeLite parser in code?

Post by lifepower »

I've got a template struct with the following declaration:

Code: Select all

template <typename T>
struct Test
{
  T member;

  using U = typename std::conditional<std::is_floating_point<T>::value, T, typename std::conditional<sizeof(T) <= 4, float, double>::type>::type;

  T getMember() const { return member; }

  U getMember2() const { return static_cast<U>(member); }
};
I'm using CodeLite 10.0.0, with clang code completion not enabled, so basically using CodeLite's own parser. If I try to use aforementioned template, e.g.:

Code: Select all

Test<int> abc;
abc. // this triggers code completion dialog
Depending on some circumstances and that template location, I either get a list of few members from a completely different class, or a list of members that were declared before that "using U" statement. Basically, that definition completely confuses CodeLite.

Likely CodeLite doesn't understand that construct and perhaps there would be other constructs that would throw havoc to CodeLite's parser. So my question is, would be there a way to detect CodeLite in code, for instance, by using something like #ifdef codelite, so that I can replace that tricky definition with something simpler that CodeLite could understand and parse the rest of template reasonably well?