on operators
This commit is contained in:
parent
cc60da788d
commit
bbbf5b4bd8
8 changed files with 30 additions and 3 deletions
8
c++-mode/const_[]
Normal file
8
c++-mode/const_[]
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: const_[]
|
||||||
|
# key: c[
|
||||||
|
# --
|
||||||
|
const ${1:Type}& operator[](${2:int index}) const
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
|
@ -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
5
c++-mode/d_operator[]
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: d_operator[]
|
||||||
|
# key: [
|
||||||
|
# --
|
||||||
|
${1:Type}& operator[](${2:int index});
|
5
c++-mode/d_operator[]_const
Normal file
5
c++-mode/d_operator[]_const
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: d_operator[]_const
|
||||||
|
# key: c[
|
||||||
|
# --
|
||||||
|
const ${1:Type}& operator[](${2:int index}) const;
|
|
@ -3,4 +3,4 @@
|
||||||
# key: io
|
# key: io
|
||||||
# contributor: Andrea crotti
|
# contributor: Andrea crotti
|
||||||
# --
|
# --
|
||||||
#include <iostream>
|
#include <iostream>
|
|
@ -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;
|
||||||
|
|
|
@ -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
8
c++-mode/operator[]
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- mode: snippet -*-
|
||||||
|
# name: operator[]
|
||||||
|
# key: []
|
||||||
|
# --
|
||||||
|
${1:Type}& operator[](${2:int index})
|
||||||
|
{
|
||||||
|
$0
|
||||||
|
}
|
Loading…
Reference in a new issue