www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/08/16:55:22

From: Ahn Ki-yung <kyagrd AT chiak DOT kaist DOT ac DOT kr>
Newsgroups: comp.os.msdos.djgpp
Subject: Problems with random_shuffle() ? __STL_NO_DRAND48
Date: Sat, 08 May 1999 17:07:04 +0900
Organization: KREONet news service
Lines: 35
Message-ID: <3733F0A8.9E09BFF3@daidun.kaist.ac.kr>
NNTP-Posting-Host: haje11.kaist.ac.kr
Mime-Version: 1.0
X-Mailer: Mozilla 4.51 [en] (Win98; I)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

If i make a list<string> and try to random shuffle these error messages come.
==============================================================================
n function `void __random_shuffle<basic_string<char,string_ ....and so on to long :-)
e:/djgpp/lang/cxx/stl_algo.h(617) Error: `lrand48' undeclared (first use this function)
e:/djgpp/lang/cxx/stl_algo.h(617) Error: (Each undeclared identifier is reported
                                                            only once
e:/djgpp/lang/cxx/stl_algo.h(617) Error: for each function it appears in.)
There were some errors
==============================================================================

So i opened stl_algo.h and the code was like this

==============================================================================
template <class RandomAccessIterator, class Distance>
void __random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
                      Distance*) {
  if (first == last) return;
  for (RandomAccessIterator i = first + 1; i != last; ++i)
#ifdef __STL_NO_DRAND48
    iter_swap(i, first + Distance(rand() % ((i - first) + 1)));
#else
  iter_swap(i, first + Distance(lrand48() % ((i - first) + 1)));
#endif
}
==============================================================================

So I defiend the __STL_NO_DRAND48 in my own source and at last it looked like
working. At least no errors.

What is __STL_NO_DRAND48 macro and Irand48 function ???

I think the default shuld be rand() but in stl_algo.h the Irand48() is the default
which wasn't even declared.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019