template <class T, template <typename> class mc>
class property : public mc<T> {
public:
property& operator= (T arg) {
this->Setter(arg);
return *this;
}
operator T() {
return this->Getter();
}
};
template<class T>
class Test {
protected:
T Getter() {
std::cout << ("GET\n");
return n;
}
void Setter(T arg) {
std::cout << ("SET\n");
n = arg;
}
T n;
};
int main() {
property<int, Test> x;
x = 10;
std::cout << "Hello World! << "<< x << "\n";
property<float, Test> y;
y = 5.3f;
std::cout << "Hello World! << "<< y << "\n";
}
var lst = new List<int>() { 1, 2, 3, 5, 1, 6, 5 };
var result = lst.Select((el, idx) => (el, idx))
.GroupBy(c => c.el)
.Where(g => g.Count() > 1)
.SelectMany(g => g.Select(c => c.idx).ToList())
.ToList(); // [0, 4, 3, 6]
String GPS = "kdlg";
String sql = "INSERT INTO gps_coordinat (class) VALUES (?)";
PreparedStatement preparedStatement = conn.prepareStatement(sql);
preparedStatement.setString(1, GPS);
int rows = preparedStatement.executeUpdate();
if(rows == 1) {
System.out.println("УСПЕХ");
} else {
System.out.println("что-то пошло не так...");
}