Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | 5b08a8a | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
Howard Hinnant | 412dbeb | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <fstream> |
| 11 | |
| 12 | // template <class charT, class traits = char_traits<charT> > |
| 13 | // class basic_fstream |
| 14 | |
| 15 | // basic_fstream(basic_fstream&& rhs); |
| 16 | |
| 17 | #include <fstream> |
| 18 | #include <cassert> |
| 19 | |
| 20 | int main() |
| 21 | { |
Howard Hinnant | 7609c9b | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 22 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Alexis Hunt | 483cf24 | 2011-07-18 23:51:21 +0000 | [diff] [blame^] | 23 | char temp[L_tmpnam]; |
| 24 | tmpnam(temp); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 25 | { |
Alexis Hunt | 483cf24 | 2011-07-18 23:51:21 +0000 | [diff] [blame^] | 26 | std::fstream fso(temp, std::ios_base::in | std::ios_base::out |
| 27 | | std::ios_base::trunc); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 28 | std::fstream fs = move(fso); |
| 29 | double x = 0; |
| 30 | fs << 3.25; |
| 31 | fs.seekg(0); |
| 32 | fs >> x; |
| 33 | assert(x == 3.25); |
| 34 | } |
| 35 | std::remove("test.dat"); |
| 36 | { |
Alexis Hunt | 483cf24 | 2011-07-18 23:51:21 +0000 | [diff] [blame^] | 37 | std::wfstream fso(temp, std::ios_base::in | std::ios_base::out |
| 38 | | std::ios_base::trunc); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 39 | std::wfstream fs = move(fso); |
| 40 | double x = 0; |
| 41 | fs << 3.25; |
| 42 | fs.seekg(0); |
| 43 | fs >> x; |
| 44 | assert(x == 3.25); |
| 45 | } |
Alexis Hunt | 483cf24 | 2011-07-18 23:51:21 +0000 | [diff] [blame^] | 46 | std::remove(temp); |
Howard Hinnant | 7609c9b | 2010-09-04 23:28:19 +0000 | [diff] [blame] | 47 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 48 | } |