on operators

This commit is contained in:
Andrea Crotti 2010-11-21 18:41:45 +01:00
parent cc60da788d
commit bbbf5b4bd8
8 changed files with 30 additions and 3 deletions

8
c++-mode/const_[] Normal file
View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: const_[]
# key: c[
# --
const ${1:Type}& operator[](${2:int index}) const
{
$0
}

View file

@ -1,5 +1,5 @@
# -*- mode: snippet -*- # -*- mode: snippet -*-
# name: d_operator<< # name: d_operator<<
# key: d<< # key: <<
# -- # --
friend ostream& operator<<(ostream&, const ${1:Class}&); friend ostream& operator<<(ostream&, const ${1:Class}&);

5
c++-mode/d_operator[] Normal file
View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: d_operator[]
# key: [
# --
${1:Type}& operator[](${2:int index});

View file

@ -0,0 +1,5 @@
# -*- mode: snippet -*-
# name: d_operator[]_const
# key: c[
# --
const ${1:Type}& operator[](${2:int index}) const;

View file

@ -3,4 +3,4 @@
# key: io # key: io
# contributor: Andrea crotti # contributor: Andrea crotti
# -- # --
#include <iostream> #include <iostream>

View file

@ -3,7 +3,7 @@
# key: += # key: +=
# contributor: Andrea crotti # contributor: Andrea crotti
# -- # --
${1:MyClass}& $1::operator+=(const $1 &rhs) ${1:MyClass}& $1::operator+=(${2:const $1 &rhs})
{ {
$0 $0
return *this; return *this;

View file

@ -6,4 +6,5 @@
ostream& operator<<(ostream& s, const ${1:type}& ${2:c}) ostream& operator<<(ostream& s, const ${1:type}& ${2:c})
{ {
$0 $0
return s;
} }

8
c++-mode/operator[] Normal file
View file

@ -0,0 +1,8 @@
# -*- mode: snippet -*-
# name: operator[]
# key: []
# --
${1:Type}& operator[](${2:int index})
{
$0
}