~ubuntu-branches/ubuntu/trusty/libc++/trusty

« back to all changes in this revision

Viewing changes to libcxx/test/numerics/rand/rand.dis/rand.dist.pois/rand.dist.pois.exp/io.pass.cpp

  • Committer: Package Import Robot
  • Author(s): Andrej Belym
  • Date: 2012-06-02 19:25:47 UTC
  • Revision ID: package-import@ubuntu.com-20120602192547-b6ta950a8ckc9um2
Tags: upstream-1.0~svn160132
ImportĀ upstreamĀ versionĀ 1.0~svn160132

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//===----------------------------------------------------------------------===//
 
2
//
 
3
//                     The LLVM Compiler Infrastructure
 
4
//
 
5
// This file is dual licensed under the MIT and the University of Illinois Open
 
6
// Source Licenses. See LICENSE.TXT for details.
 
7
//
 
8
//===----------------------------------------------------------------------===//
 
9
 
 
10
// <random>
 
11
 
 
12
// template<class RealType = double>
 
13
// class exponential_distribution
 
14
 
 
15
// template <class CharT, class Traits, class RealType>
 
16
// basic_ostream<CharT, Traits>&
 
17
// operator<<(basic_ostream<CharT, Traits>& os,
 
18
//            const exponential_distribution<RealType>& x);
 
19
 
 
20
// template <class CharT, class Traits, class RealType>
 
21
// basic_istream<CharT, Traits>&
 
22
// operator>>(basic_istream<CharT, Traits>& is,
 
23
//            exponential_distribution<RealType>& x);
 
24
 
 
25
#include <random>
 
26
#include <sstream>
 
27
#include <cassert>
 
28
 
 
29
int main()
 
30
{
 
31
    {
 
32
        typedef std::exponential_distribution<> D;
 
33
        D d1(7);
 
34
        std::ostringstream os;
 
35
        os << d1;
 
36
        std::istringstream is(os.str());
 
37
        D d2;
 
38
        is >> d2;
 
39
        assert(d1 == d2);
 
40
    }
 
41
}