Ticket #11237: rand.diff

File rand.diff, 1.1 KB (added by nathan@…, 7 years ago)

Inline the rand function so it doesn't get defined multiple times

  • boost/iostreams/filter/test.hpp

    From c33f1a7c68b8b3eee350ffc4056ca3b086626dd9 Mon Sep 17 00:00:00 2001
    From: Nathan Toone <nathan@toonetown.com>
    Date: Fri, 24 Apr 2015 10:12:54 -0600
    Subject: [PATCH] Inline rand function so it doesn't get multiply defined
     (Addresses ticket #10487 - https://svn.boost.org/trac/boost/ticket/10487)
    
    ---
     boost/iostreams/filter/test.hpp | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/boost/iostreams/filter/test.hpp b/boost/iostreams/filter/test.hpp
    index ea2fd60..3b01fed 100644
    a b const std::streamsize default_increment = 5;  
    7171    !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \
    7272    !BOOST_WORKAROUND(__MWERKS__, <= 0x3003) \
    7373    /**/
    74     std::streamsize rand(int inc)
     74    inline std::streamsize rand(int inc)
    7575    {
    7676        static rand48                random_gen;
    7777        static uniform_smallint<int> random_dist(0, inc);
    7878        return random_dist(random_gen);
    7979    }
    8080#else
    81     std::streamsize rand(int inc)
     81    inline std::streamsize rand(int inc)
    8282    {
    8383        return (std::rand() * inc + 1) / RAND_MAX;
    8484    }