Re: [Qt-creator] Syntax highlighting, template templates

2009-07-23 Thread Nico Kruber
Just as a reminder: using values as template parameters still gets underlined 
as an error when a such parameter is used to create a concrete class (see 
method foo(Aelements* var) below (or in the attached file)

templateint count
class A {
public:
  A() {
std::cout  count  std::endl;
  }
};

templateint elements
void foo(Aelements* var) {
}

templateint elements
void bar() {
  std::cout  elements;
}


Nico
#include iostream

templateint count
class A {
public:
  A() {
std::cout  count  std::endl;
  }
};

templateint elements
void foo(Aelements* var) {
}

templateint elements
void bar() {
  std::cout  elements;
}


int main() {
  foo(new A5());
  return 0;
}


signature.asc
Description: This is a digitally signed message part.
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


[Qt-creator] Syntax highlighting, template templates

2009-07-06 Thread Nico Kruber
I've been working with template templates and there are still some bugs in Qt 
Creator's syntax highlighter which highlights my code suggesting it has errors 
(snapshot from 01/07/2009):



template template typename  class Container, typename ElementType 
bool printSimulations(ContainerElement container){
}
-- 'ContainerElement' is not a type name



template template typename  class Container, typename ElementType 
bool printSimulations(ContainerElement container);
-- strangely this doesn't show any error



template template typename  class Container, typename ElementType 
bool printSimulations(ContainerElement container, const QString path);
-- 'ContainerElement' is not a type name
(adding an additional typename before Container works with the syntax 
highlighter, but not with g++ - QtCreator could instead complain about that ;) 
)



template template typename  class Container, typename ElementType 
bool printSimulations(ContainerElement container, const QString path) {
  
  typename ContainerElement::const_iterator i = container.constBegin();
  const typename ContainerElement::const_iterator end = 
container.constEnd();
  while(i != end) {
// do something
++i;
  }
}
-- 'ContainerElement' is not a type name at the function declaration
-- and 'Container is not a namespace or class name shown at the 
const_iterator lines



Cheers,
Nico Kruber


signature.asc
Description: This is a digitally signed message part.
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Syntax highlighting, template templates

2009-07-06 Thread Roberto Raggi

On Jul 6, 2009, at 2:55 PM, Nico Kruber wrote:

 Just tested your patch and it fixes my first issues but not the value-
 template.

oki, thanks for trying my patch. I think I know what's missing in my  
code, I will try to fix the remaining issues in the next few days.

ciao robe

___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Syntax highlighting, template templates

2009-07-06 Thread Roberto Raggi


Hi,

On Jul 6, 2009, at 2:55 PM, Nico Kruber wrote:


Just tested your patch and it fixes my first issues but not the value-
template.


Sorry, but do you have class Element and class QString declared  
before your templates?


I don't get any warning/error messages when I load x.cpp (attached to  
this email).


ciao robe



x.cpp
Description: Binary data


___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] Syntax highlighting, template templates

2009-07-06 Thread Nico Kruber
It's not declared, because it's (supposed to be) a template template...
but I mixed some things up when I reduced my code to the examples I gave you - 
attached is a fixed file also including the value template.
It can not even be used with g++ to prove its correctness (g++ x.cpp).

Nico

On Monday 06 July 2009 17:39:11 Roberto Raggi wrote:
 Hi,

 On Jul 6, 2009, at 2:55 PM, Nico Kruber wrote:
  Just tested your patch and it fixes my first issues but not the value-
  template.

 Sorry, but do you have class Element and class QString declared
 before your templates?

 I don't get any warning/error messages when I load x.cpp (attached to
 this email).

 ciao robe
#include iostream

template template typename /* ElementType */  class Container, typename ElementType 
bool foo1(ContainerElementType container){
}

template template typename /* ElementType */  class Container, typename ElementType 
bool foo2(ContainerElementType container);


template template typename /* ElementType */  class Container, typename ElementType 
bool foo3(ContainerElementType container, const int number);


template template typename /* ElementType */  class Container, typename ElementType 
bool foo4(ContainerElementType container, const int number) {

 typename ContainerElementType::const_iterator i = container.constBegin();
 const typename ContainerElementType::const_iterator end =  container.constEnd();
 while(i != end) {
   // do something
   ++i;
 }
}

templatetypename T, int count
class A {
  T t;
public:
  A() {
std::cout  count  std::endl;
  }
};

templateint elements
void foo5(Adouble, elements* var) {
}

int main() {
  foo5(new Adouble, 5());
  return 0;
}

signature.asc
Description: This is a digitally signed message part.
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator