/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
contrib/python/kiwisolver/py2/kiwi/expression.h
57 строк
1 KB
Anton Myagkov
Update ydb version to 24.4 (#4579)
07 фев 2026, 11:59
Не верифицирован
07 фев 2026, 11:59
2c21cae
Код
Авторство
О чём код?
/*----------------------------------------------------------------------------- | Copyright (c) 2013-2017, Nucleic Development Team. | | Distributed under the terms of the Modified BSD License. | | The full license is in the file COPYING.txt, distributed with this software. |----------------------------------------------------------------------------*/ #pragma once #include <vector> #include "term.h" namespace kiwi { class Expression { public: Expression( double constant = 0.0 ) : m_constant( constant ) {} Expression( const Term& term, double constant = 0.0 ) : m_terms( 1, term ), m_constant( constant ) {} Expression( const std::vector<Term>& terms, double constant = 0.0 ) : m_terms( terms ), m_constant( constant ) {} ~Expression() {} const std::vector<Term>& terms() const { return m_terms; } double constant() const { return m_constant; } double value() const { typedef std::vector<Term>::const_iterator iter_t; double result = m_constant; iter_t end = m_terms.end(); for( iter_t it = m_terms.begin(); it != end; ++it ) result += it->value(); return result; } private: std::vector<Term> m_terms; double m_constant; }; } // namespace kiwi