Code Monkey home page Code Monkey logo

gcxx11's People

Contributors

mihkhub avatar

gcxx11's Issues

Function Objects

A function object, or functor, is an object that has operator () defined so that in the following example:

FunctionObjectType fo;
  // ...
fo(...);

the expression fo() is a call of oerator () for the function object fo instead of a call of the function fo().
At first, you could consider a function object as an ordinary function that is written in a more complicated way. Instead of writing all the function statemetns inside the function body:

void fo() {
 statements
}

your write them inside the body of operator () of the function object class:

class FunctionObjectType {
 public:
       void operator() {
           statements
       }
}

This kind of definition is more complicated but has three important advantages:

  • A function object might be smarter because it may have a state.
  • Each function object has its owen type. Thus , you can pass the type of function object to a template to specify a certain behavior.
  • A function object is usually faster than a function pointer.

1.1.2 C/C++ 2011

In this implementation -std=gnu++11 or -std=c++11 flags must be used to enable language and library features.

Enumerations

An enumeration is a set of named interger contants that specify all the legal values a variable of that type may have.

the gneral form for enumerations is:

enum enum-type-name {enumeration list} variable_list;

The Casting Operators

C++ defines five casting operators, The first is the traditional-style cast inherited from c.

The remaning four:

  • dynamic_cast
  • const_cast
  • reinterpret_cast
  • static_cast

3.8.5 Using gdb

Many options are available for GDB itself: please see "GDB features for C++" in the GDB documentation. Also recommended:
the other parts of this manual.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.