-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathutils.h
43 lines (31 loc) · 939 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include "real.h"
#include <algorithm>
#include <fstream>
#include <vector>
#if defined(__clang__) || defined(__GNUC__)
#define FASTTEXT_DEPRECATED(msg) __attribute__((__deprecated__(msg)))
#elif defined(_MSC_VER)
#define FASTTEXT_DEPRECATED(msg) __declspec(deprecated(msg))
#else
#define FASTTEXT_DEPRECATED(msg)
#endif
namespace fasttext {
using Predictions = std::vector<std::pair<real, int32_t>>;
namespace utils {
int64_t size(std::ifstream&);
void seek(std::ifstream&, int64_t);
template <typename T>
bool contains(const std::vector<T>& container, const T& value) {
return std::find(container.begin(), container.end(), value) !=
container.end();
}
} // namespace utils
} // namespace fasttext