[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Re: [NOVICE] C++



sslug@sslug wrote:
> 
> In article Anders Melchiorsen <sslug@sslug> wrote:
> > Men Stroustrups bog til C++ blev godt gennempløjet dengang , og den er
> > faktisk rimelig anvendelig som opslagsbog.
> Bjarnes bog er god til opslag -- som introduktion til programering tror
> jeg aldrig den har været ment.
> 
> > I forbindelse med kapitel 20.3.8 Comparisons (strings), er jeg faldet
> > over en del uoverenstemmelser i syntax til "compare()" kaldene.
> > Bla.: står der :
> >
> > int compare(size_type pos, site_type n, const basic_string& str) const;
> >
> > Men Gnu C++  vil have det som:
> >
> > int compare(const basic_string& str, size_type pos, size_type n) const;
> ...
> > Hvilken er den rigtige syntax?
> 
> template <typename charT, typename traits>
> int
> basic_string<charT, traits>
> ::compare(size_type pos, site_type n, const basic_string<charT, traits>&
> str) const;
> 
> som angivet af Bjarne 3.ed 1.printing 20.3.8 p.590 og corroberet af
> ISO/IEC 14882:1998(E) 21.3.6.8 subclause 5 p.401 burde være den rigtige.
> Så *vidt* jeg husker er GNU C++s "perception" af en basic_string ikke
> sammenfaldende med STL std::string?

En nærmere undersøgelse af libstdc++ (gcc 2.95.3) viser at hvis
man inkluderer <String.h>, får man fat i den gamle non-template string-
klasse. <string> derimod, inkluderer bastring.h som åbenbart er et GNU
"hack" af basic_string: 

/usr/include/g++ > less string 

// Main header for the -*- C++ -*- string classes.
 
#ifndef __STRING__
#define __STRING__
 
#include <std/bastring.h>
 
extern "C++" {
typedef basic_string <char> string; <======= uha
// typedef basic_string <wchar_t> wstring;
} // extern "C++"
 
#endif
string lines 1-13/13 (END)                    

Åbenbart ingen wstring-understøttelse heller.

-- 
Mvh
Lau Sennels


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *