Opened 15 years ago
Closed 15 years ago
#360 closed defect (fixed)
VS compilation error
Reported by: | Peter Kovacs | Owned by: | Peter Kovacs |
---|---|---|---|
Priority: | blocker | Milestone: | LEMON 1.2 release |
Component: | core | Version: | hg main |
Keywords: | Cc: | ||
Revision id: |
Description
bellman_ford_test.cc fails to compile with Visual Studio 2005 and 2008:
..\..\test\bellman_ford_test.cc(108) : error C3083: 'SetOperationTraits<lemon::BellmanFordToleranceOperationTraits<int,0> > >': the symbol to the left of a '::' must be a type
Attachments (1)
Change History (8)
comment:1 Changed 15 years ago by
Status: | new → assigned |
---|
comment:2 follow-up: 3 Changed 15 years ago by
The situation is even worse. The BellmanFordToleranceTraits
solution that I proposed in #51 is illegal for non-integer types.
E.g. using this struct:
template <typename T, T x> struct A {};
this code
A<double, 0.0> a;
cannot be compiled. GCC says:
error: ‘double’ is not a valid type for a template constant parameter
However, this one works:
A<int, 0> a;
I must admit that I did not check this solution for floating point types (for which it was actually intended). I'm sorry. What to do then? Revert [a6eb9698c321]?
comment:3 follow-ups: 4 6 Changed 15 years ago by
Replying to kpeter:
The situation is even worse. The
BellmanFordToleranceTraits
solution that I proposed in #51 is illegal for non-integer types.E.g. using this struct:
template <typename T, T x> struct A {};this code
A<double, 0.0> a;cannot be compiled. GCC says:
error: ‘double’ is not a valid type for a template constant parameterHowever, this one works:
A<int, 0> a;I must admit that I did not check this solution for floating point types (for which it was actually intended). I'm sorry. What to do then? Revert [a6eb9698c321]?
It can be a fast solution, because this operation traits class is not used from other places.
In long time, I suggest to use non static operation traits classes, i.e. an instance can be constructed in the algorithm, which can hold the epsilon or a tolerance instance. This can be done in next release because it can be implemented with backward compatibility (it should be done in Dijkstra, as well).
comment:4 Changed 15 years ago by
Replying to deba:
It can be a fast solution, because this operation traits class is not used from other places.
Yes, it can be safely reverted, though it is not so nice to introduce a new feature and completely remove it soon after. :)
In long time, I suggest to use non static operation traits classes, i.e. an instance can be constructed in the algorithm, which can hold the epsilon or a tolerance instance. This can be done in next release because it can be implemented with backward compatibility (it should be done in Dijkstra, as well).
That was my first suggestion, too. It also requires set/get functions for the introduced op. traits object of the algorithm.
comment:5 follow-up: 7 Changed 15 years ago by
The attached patch [34380851fc86] undos the changes of [a6eb9698c321]. I'm sorry again for not testing the proposal correctly.
Using this patch, the library compiles using both GCC 4.1 and VS2008.
Changed 15 years ago by
Attachment: | 360-34380851fc86.patch added |
---|
comment:6 Changed 15 years ago by
Replying to deba:
In long time, I suggest to use non static operation traits classes, i.e. an instance can be constructed in the algorithm, which can hold the epsilon or a tolerance instance. This can be done in next release because it can be implemented with backward compatibility (it should be done in Dijkstra, as well).
I created a follow-up ticket for this proposal, see #361.
comment:7 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to kpeter:
The attached patch [34380851fc86] undos the changes of [a6eb9698c321].
A more standard way of doing this kind of undo is unsing the hg backout
command. See [d6052a9c4e8d].
It is already in the main branch and will also e merges to 1.2 together with the other relevant updates.
I found two problems here.
::SetOperationTraits<...>
in a template named parameter list. However, this problem can be simply avoid.BellmanFordToleranceTraits
class, which has the following template parameter list: