www.digitalmars.com         C & C++   DMDScript  

c++ - Breakthrough!!

Walter

As we discussed the other day, I've been working on the issues preventing
the STLSoft libraries working fully with DMC++. I now think I've found the
main culprit, which was affecting many of the classes.

I've included the file inltempl.cpp, which is a massively chopped down
version of the winstl::findvolume_sequence template, and the test program.
If you compile the file (with 8.28, 8.29 or 8.30.3), you get

  h:\dev\test\compiler\dm\inltempl\inltempl.cpp(137) : Error:
'basic_findvolume_sequence_value_type' is not a class template
  Fatal error: premature end of source file
  --- errorlevel 1

Now, basic_findvolume_sequence_value_type is in the winstl namespace by
default, along with all the other classes in this API. The method it refers
to is an out-of-class inline method, as in

  template <ws_typename_param_k C, ws_typename_param_k T>
  inline basic_findvolume_sequence_value_type<C,
T>::basic_findvolume_sequence_value_type()
  {
      m_name[0] = '\0';
  }

It seems that DMC++ does not see the definition of an out-of-class inline
method as being in the namespace where it is (in the code sense) defined.
Perhaps it erroneously infers the namespace from the point of instantiation.
This would explain why some methods suffer the symptoms given (which would
be those used outside the namespace) and others do not (which would be those
used only within). This hypothesis is backed up by a little experiment. If
you go to the point in the file where I've marked it "WALTER, LOOK HERE!!"
and change the #if 1 to #if 0 to select the alternate implementation, where
the winstl namespace qualification is applied to the inline definition of
the function, as in

  #if 1
  // original version
  template <typename C, typename T>
  inline basic_findvolume_sequence_value_type<C,
T>::basic_findvolume_sequence_value_type()
  {
  }
  #else
  // Explicitly qualified version
  template <typename C, typename T>
  inline winstl::basic_findvolume_sequence_value_type<C,
T>::basic_findvolume_sequence_value_type()
  {
  }
  #endif /* 1 */

then it all works ok.

To fix this, I could concoct a qualifying macro to be appended to all
out-of-class inline function definitions, but I think the best workaround in
the short to term is to not use the STLSoft namespaces until the compiler
can work with them correctly.

I've just confirmed that this works by defining the _WINSTL_NO_NAMESPACES
and _STLSOFT_NO_NAMESPACES symbols on a couple of projects that were
formerly broken with DMC++, and all is well. How simple!!

So in the short term I will simply amend the main headers such that
namespace support is not the default when using DMC++, and when you are able
to fix the compiler, I think the STLSoft libraries may well have full DMC++
compatibility.

Hurrah!

Matthew




begin 666 inltempl.cpp
M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($EN8VQU

M86QG;W)I=&AM/ T*(VEN8VQU9&4 /'=I;F1O=W,N:#X-" T*+RH +R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($YA;65S<&%C90T*("HO

M:6YS=&Q?;G-?<75A;"AX*2  ("  ("  (" Z.G=I;G-T;#HZ> T*("-D969I
M;F4 =VEN<W1L7VYS7W5S:6YG*' I("  ("  ("  =7-I;F< .CIW:6YS=&PZ



M"B C9&5F:6YE('=I;G-T;%]N<U]Q=6%L7W-T9"AX*2  ("  (#HZ<W1D.CIX

M.G-T9#HZ>#L-




M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M:6YD=F]L=6UE7W-E<75E;F-E7W1R86ET<PT*=&5M<&QA=&4 /'1Y<&5N86UE




M(&-L87-S(&)A<VEC7V9I;F1V;VQU;65?<V5Q=65N8V5?8V]N<W1?:71E<F%T
M;W(-"G1E;7!L871E(#QT
M92!6/ T*8VQA<W, 8F%S:6-?9FEN9'9O;'5M95]S97%U96YC95]C;VYS=%]I
M=&5R871O<CL-" T*+R\ 8VQA<W, 8F%S:6-?9FEN9'9O;'5M95]S97%U96YC
M90T*=&5M<&QA=&4 /'1Y<&5N86UE($,L('1Y<&5N86UE(%0 /2!F:6YD=F]L


M("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  

M("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  
M("!T<F%I='-?='EP93L-"B  ("!T>7!E9&5F(&)A<VEC7V9I;F1V;VQU;65?
M<V5Q=65N8V4\0RP 5#X ("  ("  ("  ("  ("  ("  ("  ("  ("  (&-L

M;F-E7W9A;'5E7W1Y<&4\0RP 5#X ("  ("  ("  ("  ("  ("!V86QU95]T
M>7!E.PT*("  ('1Y<&5D968 8F%S:6-?9FEN9'9O;'5M95]S97%U96YC95]C


M("  ("  ("  ("  ("  ("  ("  ("  ("  ("  (" F<F5F97)E;F-E.PT*
M("  ('1Y<&5D968 8V]N<W0 =F%L=65?='EP92  ("  ("  ("  ("  ("  
M("  ("  ("  ("  ("  ("  ("  ("  ("  )F-O;G-T7W)E9F5R96YC93L-

M;'5M95]S97%U96YC92 I.PT*("  ('YB87-I8U]F:6YD=F]L=6UE7W-E<75E




M;&%S<U]T>7!E(&-O;G-T("8I.PT*("  (&-O;G-T(&)A<VEC7V9I;F1V;VQU
M;65?<V5Q=65N8V4 )F]P97)A=&]R(#TH8VQA<W-?='EP92!C;VYS=" F*3L-

M<&5S+B J+PT*='EP961E9B!B87-I8U]F:6YD=F]L=6UE7W-E<75E;F-E/&-H
M87(L(&9I;F1V;VQU;65?<V5Q=65N8V5?=')A:71S/&-H87(^(#X ("  ("  
M("  9FEN9'9O;'5M95]S97%U96YC95]A.PT*='EP961E9B!B87-I8U]F:6YD
M=F]L=6UE7W-E<75E;F-E/'=C:&%R7W0L(&9I;F1V;VQU;65?<V5Q=65N8V5?
M=')A:71S/'=C:&%R7W0^(#X ("  9FEN9'9O;'5M95]S97%U96YC95]W.PT*

M<&4-"G1E;7!L871E(#QT


M("  ("  ("  ("  ("  (&-H87)?='EP93L-"B  ("!T>7!E9&5F(%0 ("  
M("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  =')A:71S

M7W9A;'5E7W1Y<&4\0RP 5#X
M("!B87-I8U]F:6YD=F]L=6UE7W-E<75E;F-E7W9A;'5E7W1Y<&4H*3L-"B  
M("!B87-I8U]F:6YD=F]L=6UE7W-E<75E;F-E7W9A;'5E7W1Y<&4H8VQA<W-?
M='EP92!C;VYS=" F<FAS*3L-" T*("  (&-L87-S7W1Y<&4 )F]P97)A=&]R
M(#TH8VQA<W-?='EP92!C;VYS=" F<FAS*3L-" T*("  (&]P97)A=&]R(&-O
M;G-T(&-H87)?='EP92 J(" I(&-O;G-T.PT*?3L-" T*+R\ 8VQA<W, 8F%S
M:6-?9FEN9'9O;'5M95]S97%U96YC95]C;VYS=%]I=&5R871O< T*=&5M<&QA



M("  ("  ("  ("  ("  ("  ("  ("  ("  ("  8VAA<E]T>7!E.PT*("  
M('1Y<&5D968 5"  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  
M("  ("  ("  ("  ("  ('1R86ET<U]T>7!E.PT*("  ('1Y<&5D968 5B  
M("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  

M7W-E<75E;F-E7V-O;G-T7VET97)A=&]R/$,L(%0L(%8^("  8VQA<W-?='EP
M93L-" T*<'5B;&EC. T*("  (&)A<VEC7V9I;F1V;VQU;65?<V5Q=65N8V5?
M8V]N<W1?:71E<F%T;W(H*3L-"B  ("!B87-I8U]F:6YD=F]L=6UE7W-E<75E

M"B  ("!B87-I8U]F:6YD=F]L=6UE7W-E<75E;F-E7V-O;G-T7VET97)A=&]R

M8SH-"B  ("!C;&%S<U]T>7!E("9O<&5R871O<B K*R I.PT*("  (&-O;G-T
M(&-L87-S7W1Y<&4 ;W!E<F%T;W( *RLH:6YT*3L-"B  ("!C;VYS="!V86QU
M95]T>7!E(&]P97)A=&]R("HH*2!C;VYS=#L-"B  ("!B;V]L(&]P97)A=&]R
M(#T
M<&5R871O<B A/2AC;&%S<U]T>7!E(&-O;G-T("9R:',I(&-O;G-T.PT*?3L-
M" T*+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O






M:6-?9FEN9'9O;'5M95]S97%U96YC95]V86QU95]T>7!E/$,L(%0^.CIB87-I
M8U]F:6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