Most recent pastes (filtered)
#include <iostream> #include "CCounter.h" #include "CForwardCounter.h" #include "CVariableCounter.h" using namespace std; template <class type> type derGroessere( const type &a,const type &b) { return a > b ? a : b;} int main() { CForwardCounter gesamtzaehler; CCounter *zaehler1 = new CForwardCounter; CCounter *zaehler2 = new CVariableCounter(-2); //Upcast zaehler1->setValue(0); //Anfangswerte eintragen zaehler2->setValue(50); //Anfangswerte eintragen
template <class type> type& derGroessere( type& a, type& b) { return a > b ? a : b } //const an geeigneten stellen einfügen
void CSwapper::swap_byReference(int& value1, int& value2){ int tmp = value1; value1 = value2; value2 = tmp; } void CSwapper::swap_byPointer(int* value1, int* value2){ int* tmp = value1; value1 = value2; value2 = tmp; }
#include "CCounter.h" CCounter::CCounter() { m_value=0; } CCounter::~CCounter(void) { } void CCounter::count() { } int CCounter::getValue() const {
#ifndef CCOUNTER_H_ #define CCOUNTER_H_ class CCounter { public: CCounter(void); ~CCounter(void); virtual void count(void) ; int getValue(void) const; void setValue(int); void resetValue(void); bool operator<(const CCounter&); bool operator>(const CCounter&); private: int m_value; }; #endif
class CCounter { public: CCounter(void); ~CCounter(void); void count(void); int getValue(void); void setValue(int); void resetValue(void); private: int m_value; }; 1>c:\users\arock\dropbox\max_den\programmieren\c++\übungen\2\blatt 2\ccounter.h(2): error C2011: 'CCounter': 'class' Typneudefinition 1> c:\users\arock\dropbox\max_den\programmieren\c++\übungen\2\blatt 2\ccounter.h(2): Siehe Deklaration von 'CCounter'
// the pain one must endure to force all arguments to be the same ... template<class... Args> auto writev(const Args&... args) -> typename std::pair< decltype( std::declval<std::tuple<typename std::pair<Packet&, Args>::first_type...>>() = std::make_tuple(args...)), size_t>::second_type
#include <algorithm> #include <iostream> #include <vector> using namespace std; class graph { public: graph(int count) : _paths(0) , _accessibility(count) { for (int i = 0; i < count; i++) { _accessibility.push_back(vector<bool>(count)); _accessibility[i].resize(count); fill(_accessibility[i].begin(), _accessibility[i].end(), false); } _used.resize(count); fill(_used.begin(), _used.end(), false);
#include <algorithm> #include <iostream> #include <vector> using namespace std; class graph { public: graph(int count) : _paths(0) , _accessibility(count) { for (int i = 0; i < count; i++) { _accessibility.push_back(vector<bool>(count)); _accessibility[i].resize(count); fill(_accessibility[i].begin(), _accessibility[i].end(), false); } _used.resize(count); fill(_used.begin(), _used.end(), false);
public int GetDiskFreeSpace(ref ulong freeBytesAvailable, ref ulong totalBytes, ref ulong totalFreeBytes, DokanFileInfo info) { DebugCall("GetDiskFreeSpace"); try { // Get current db usage Int64 used = (Int64)PostgreSQL.Command("SELECT pg_database_size(current_database())") .ExecuteScalar(); Debug("GetDiskFreeSpace - Used space: {0}", used); // Get free disk space on the server // This requires the postdok_free_disk_space function on the server! //Int64 free = (Int64)PostgreSQL.Command("SELECT postdok_free_disk_space()") // .ExecuteScalar(); Int64 free = 1024 * 1024; freeBytesAvailable = (ulong)free; totalFreeBytes = (ulong)free; totalBytes = (ulong)(used + free);
public int FindFiles( String filename, ArrayList files, DokanFileInfo info) { Debug("FindFiles {0}", filename); try { string path = GetPath(filename); ArrayList entries = (ArrayList)GetChannel().ls(path); foreach (ChannelSftp.LsEntry entry in entries) { FileInformation fi = new FileInformation(); fi.Attributes = entry.getAttrs().isDir() ? FileAttributes.Directory : FileAttributes.Normal;
public int FindFiles(string filename, ArrayList files, DokanFileInfo info) { DebugCall("FindFiles on \"{0}\"", filename); try { //NpgsqlDataReader rdr = PostgreSQL.Command("SELECT * FROM files WHERE dir = :dir") // .AddParam("dir", NpgsqlDbType.Varchar, filename) // .ExecuteReader(); FileInformation fi = new FileInformation(); fi.FileName = "moep.txt"; files.Add(fi); return 0; } catch (NpgsqlException e) { DebugError("FindFiles", e.BaseMessage); return -DokanNet.ERROR_PATH_NOT_FOUND; } }