Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  optional.hpp   Sprache: C

 
//  Please refer to the COPYRIGHT file of the profiling package for details.
//  SPDX-License-Identifier: MIT
#ifndef OPTIONAL_HPP
#define OPTIONAL_HPP

#include <assert.h>

template<typename T>
class optional
{
    T t;
    bool present;


    typedef void (optional::*bool_type)() const;
    void random_function_name() const {}
public:
    operator bool_type() const
    {
        bool_type tr = &optional::random_function_name;
        bool_type f(0);
        return present ? tr : f;
    }

    void clear()
    { present = false; }

    T& operator*()
    {
        assert(present);
        return t;
    }

    const T& operator*() const
    {
        assert(present);
        return t;
    }

    optional() : present(false)
    { }

    optional(const T& _t) : t(_t), present(true)
    { }

    optional(const optional& o) : t(o.t), present(o.present)
    { }

};

// This function is just to provide nicer looking notation
template<typename T>
optional<T> empty_optional()
return optional<T>(); }

#endif

99%


¤ Dauer der Verarbeitung: 0.19 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge