Skip to content

Commit 12ad88c

Browse files
committed
bak
1 parent 4d23db7 commit 12ad88c

5 files changed

Lines changed: 23 additions & 42 deletions

File tree

‎cpp/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,15 @@
6060
1. [Headers](common.hpp)
6161
1. [Containers](containers.md)
6262
1. [vector](vector.cpp)
63+
1. [string](string.cpp)
6364
1. [list](list.cpp)
6465
1. [map](map.cpp)
6566
1. [multimap](multimap.cpp)
6667
1. [set](set.cpp)
6768
1. [unordered_set](unordered_set.cpp)
6869
1. [valarray](valarray.cpp)
6970
1. [deque](deque.cpp)
70-
1. [string](string.cpp)
71+
1. [bitset](bitset.cpp)
7172
1. IO
7273
1. [sstream](sstream.cpp)
7374
1. [iostream](iostream.cpp)

‎cpp/bitset.cpp‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "common.hpp"
2+
3+
int main() {
4+
// String init.
5+
{
6+
// Basic.
7+
{
8+
std::bitset<4> s("1010");
9+
std::cout << s << std::endl;
10+
assert(!s[0]);
11+
}
12+
13+
// Missing bits: MSB filled with zeroes.
14+
{
15+
std::bitset<4> s("10");
16+
assert(s == std::bitset<4>("0010"));
17+
}
18+
}
19+
}

‎cpp/common.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <atomic>
1717
#include <algorithm> // copy, erase, lower_bound, remove_if, swap, transform
18+
#include <bitset>
1819
#include <exception> // bad_alloc, bad_cast, bad_exception, bad_typeid, exception, ios_base::failure
1920
#include <fstream> // fstream, ifstream, ofstream
2021
#include <functional> // bind2nd

‎cpp/file_io.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Read entire file into a string at once.
2323
*/
2424
void read_file(std::ifstream &ifs, std::string &data_read) {
2525
ifs.seekg(0, std::ios::end);
26-
size_t size = ifs.tellg();
26+
auto size = ifs.tellg();
2727
data_read.resize(size);
2828
ifs.seekg(0);
2929
ifs.read(&data_read[0], size);

‎cuda/inc.ptx‎

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)