Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTetsuo Kiso <tetsuo-s@is.naist.jp>2012-05-30 18:11:09 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2012-05-30 18:11:09 +0400
commitbeb2256dbaf420ed525cc8354617ead0db315060 (patch)
treef5ef7deca385e984563e720f4ae2d7cd887018a3 /mert/MiraWeightVector.h
parent01eb60f35031157b5a780e539473dfd88a7714d1 (diff)
Move 'using namespace std' out from .h.
Add "std" to size_t, too.
Diffstat (limited to 'mert/MiraWeightVector.h')
-rw-r--r--mert/MiraWeightVector.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/mert/MiraWeightVector.h b/mert/MiraWeightVector.h
index 375858634..65b374625 100644
--- a/mert/MiraWeightVector.h
+++ b/mert/MiraWeightVector.h
@@ -4,7 +4,7 @@
*
* A self-averaging weight-vector. Good for
* perceptron learning as well.
- *
+ *
*/
#ifndef MERT_MIRA_WEIGHT_VECTOR_H
@@ -14,8 +14,6 @@
#include "MiraFeatureVector.h"
-using namespace std;
-
class AvgWeightVector;
class MiraWeightVector {
@@ -29,7 +27,7 @@ public:
* Constructor with provided initial vector
* \param init Initial feature values
*/
- MiraWeightVector(const vector<ValType>& init);
+ MiraWeightVector(const std::vector<ValType>& init);
/**
* Update a the model
@@ -60,12 +58,12 @@ public:
AvgWeightVector avg();
friend class AvgWeightVector;
-
+
private:
/**
* Updates a weight and lazily updates its total
*/
- void update(size_t index, ValType delta);
+ void update(std::size_t index, ValType delta);
/**
* Make sure everyone's total is up-to-date
@@ -75,12 +73,12 @@ private:
/**
* Helper to handle out-of-range weights
*/
- ValType weight(size_t index) const;
-
- vector<ValType> m_weights;
- vector<ValType> m_totals;
- vector<size_t> m_lastUpdated;
- size_t m_numUpdates;
+ ValType weight(std::size_t index) const;
+
+ std::vector<ValType> m_weights;
+ std::vector<ValType> m_totals;
+ std::vector<std::size_t> m_lastUpdated;
+ std::size_t m_numUpdates;
};
/**
@@ -90,8 +88,8 @@ class AvgWeightVector {
public:
AvgWeightVector(const MiraWeightVector& wv);
ValType score(const MiraFeatureVector& fv) const;
- ValType weight(size_t index) const;
- size_t size() const;
+ ValType weight(std::size_t index) const;
+ std::size_t size() const;
private:
const MiraWeightVector& m_wv;
};