Sponsored Content
Full Discussion: Operators
Top Forums UNIX for Dummies Questions & Answers Operators Post 302213659 by jhtrice on Thursday 10th of July 2008 06:41:08 PM
Old 07-10-2008
Meaning add the value of $10 to the variable tmp.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Arithmetic Operators

Hello, I have a list of 'inputs' and i want to convert those on the second list named 'Desired Outputs', but i don't know how to do it? Inputs Desired Outputs 1 2 94 4 276 8 369 10 464 12 ... (0 Replies)
Discussion started by: filda
0 Replies

2. Shell Programming and Scripting

And and OR Operators with If Statement.

Hi All, I have 2 variables. Result1 and Result2. I want to put a condition that if Both are True then echo "All True" Else Show Error. Right now i am doing this and getting error. if ; then echo "All True" else echo "Failed" fi; Error. line 8: ' Solution: Looking for (2 Replies)
Discussion started by: mkashif
2 Replies

3. Shell Programming and Scripting

Operators

I really don't know the meaning of these operators. Could someone explain the meanings so I can make my test for today? <, <=, ==, !=, >=, >, ||, &&, ! ~ , !~ Thanks! (1 Reply)
Discussion started by: Erjen
1 Replies

4. Homework & Coursework Questions

Operators

I really don't know the meaning of these operators. Could someone explain the meanings? <, <=, ==, !=, >=, >, ||, &&, ! ~ , !~ Thanks! (1 Reply)
Discussion started by: Erjen
1 Replies

5. Shell Programming and Scripting

Miscellaneous operators

Hi everyone, I read some shell script code,then I have some issue. the following code. let "t1 = ((5 + 3, 7 - 1, 15 - 4))" echo "t1 = $t1" t1=11 Here t1 is set to the result of the last operation.why? (3 Replies)
Discussion started by: luoluo
3 Replies

6. Shell Programming and Scripting

Array operators

Hi Lets say I have two arrays: VAR_1 = "File_A" "File_B" "File_C" "File_D" VAR_2 = "File_A" "File_D" Is there a simple command to get the difference of these list, i.e. VAR_1_2 = "File_B" "File_C" or do I have to write a script and loop through all elements and compare them one by one? ... (1 Reply)
Discussion started by: Wernfried
1 Replies

7. Shell Programming and Scripting

operators in if loop

Hi all, I have a variable which is having the value like below, $ echo ${p} 8 15 22 30 $ My requirement is that the variable should return true when it contains only one number like below, $ echo ${p} 15 $ Otherwise, it should return false if it contains more than one number. I... (4 Replies)
Discussion started by: raghu.iv85
4 Replies

8. Programming

Combining Operators

Hey everyone, I'm really getting into learning C, but as I look at more advanced example code, I see things like if (!*variable1) blah blah blah... and variable2 ^= *(variable1++); my question is, when you have a combination of two operators, like !*. The ! means 'not' and the *... (2 Replies)
Discussion started by: Lost in Cyberia
2 Replies

9. UNIX for Beginners Questions & Answers

Bash -o -v -R operators

I do not know the use of the -o -v -R operators. This is what the info says and I am confused of what optname and varname mean, are they just normal variable? -o optname True if the shell option optname is enabled. See the list of options under the ... (6 Replies)
Discussion started by: kristinu
6 Replies
binops(3bobcat) 						 Binary Operators						   binops(3bobcat)

NAME
binops - Template functions for class-type binary operators SYNOPSIS
#include <utility> #include <bobcat/typetrait> #include <bobcat/binops> DESCRIPTION
Classes can overload binary operators. A class named Class may overload these binary operators to suit its own needs, allowing, e.g., two Class type objects to be added after overloading operator+. Operators for the binary operators *, /, %, +, -, <<, >>, &, |, and ^ (in this man-page they are generically indicated as the `@' operator) can be overloaded by defining the operator@ function. If a class supports copy construction and if it offers binary assignment operators (i.e., it offers members of the form operator@=), then the matching binary operators can all be implemented identically. The move-aware Class &operator@(Class &&lhs, Class const &rhs) is easily implemented in terms of operator@= (note that the class itself doesn't have to be `move-aware' to define this function). The move-aware binary operator one requires a one line implementation, and as its implementation never changes it could safely be defined inline: Class operator@(Class &&lhs, Class const &rhs) { return std::move(lhs @= rhs); } The traditional binary operator can be implemented using its standard form: Class operator@(Class const &lhs, Class const &rhs) { Class tmp(lhs); tmp @= rhs; return tmp; } The implementation in bobcat/binops is slightly more complex as it allows from lhs or rhs promotions. As the binary operators can all be implemented alike their definitions are perfectly suited for templates: A class offering a particular operator@= then automatically also offers the matching binary operators after including bobcat/binops. Since the binary function templates are not instantiated until used their definitions can be processed by the compiler even if a class implements only a subset of the avail- able binary assignment operators. NAMESPACE
The binary operator functions templates in bobcat/binops are not implemented in a particular namespace. This allows sources to include bob- cat/binops in multiple namespaces. If bobcat/binops is to be used in multiple namespaces then the include safeguard (using the identifier INCLUDED_BOBCAT_BINOPS_) must be suppressed between inclusions of bobcat/binops in different namespaces. E.g., to make the binary operator function templates available in a source file using the namespace FBB and in a source file using the default namespace the following scheme can be used: #include <utility> // ensure std::move is available #include <bobcat/typetrait> // required by binops namespace MY_NAMESPACE { #include <bobcat/binops> // binary operators available in MY_NAMESPACE } #undef INCLUDED_BOBCAT_BINOPS_ // suppress the include guard #include <bobcat/binops> // read binops again so the binary // operators can be used in the // default namespace as well INHERITS FROM
- OVERLOADED OPERATORS
The function templates in bobcat/binops implement all arithmetic binary operators, both move-aware and the traditional binary operators, expecting constant lvalue references. They can be used if the matching binary assignment operators were implemented in the classes for which the templates must be instantiated. The following operators are available: Move-aware operators, using temporary objects for its left-hand side operands: o Class operator*(Class &&lhs, Class const &rhs): o Class operator/(Class &&lhs, Class const &rhs): o Class operator%(Class &&lhs, Class const &rhs): o Class operator+(Class &&lhs, Class const &rhs): o Class operator-(Class &&lhs, Class const &rhs): o Class operator<<(Class &&lhs, Class const &rhs): o Class operator>>(Class &&lhs, Class const &rhs): o Class operator&(Class &&lhs, Class const &rhs): o Class operator|(Class &&lhs, Class const &rhs): o Class operator^(Class &&lhs, Class const &rhs): `Traditional' operators, using lvalue references to constant objects for its left-hand side operands: o Class operator*(Class const &lhs, Class const &rhs): o Class operator/(Class const &lhs, Class const &rhs): o Class operator%(Class const &lhs, Class const &rhs): o Class operator+(Class const &lhs, Class const &rhs): o Class operator-(Class const &lhs, Class const &rhs): o Class operator<<(Class const &lhs, Class const &rhs): o Class operator>>(Class const &lhs, Class const &rhs): o Class operator&(Class const &lhs, Class const &rhs): o Class operator|(Class const &lhs, Class const &rhs): o Class operator^(Class const &lhs, Class const &rhs): The latter group of operators also support promotions. EXAMPLE
#include <iostream> #include <utility> #include "../../typetrait/typetrait" #include "../binops" class Demo { friend std::ostream &operator<<(std::ostream &out, Demo const &demo); int d_value; public: Demo(int value = 0) : d_value(value) {} Demo(Demo const &other) : d_value(other.d_value) { std::cout << "Demo CC called "; } Demo &operator+=(Demo const &rhs) { d_value += rhs.d_value; return *this; } }; std::ostream &operator<<(std::ostream &out, Demo const &demo) { return out << demo.d_value; } using namespace std; int main() { Demo four(4); Demo five(5); cout << four + five << ' ' << four + 5 << ' ' << 4 + five << ' '; } FILES
bobcat/binops - defines the binary operator function templates SEE ALSO
bobcat(7) BUGS
o The header files utility, defining std::move, and bobcat/typetrait are required by, but are not included by bobcat/binops. This was a design decision, see the NAMESPACE section. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 binops(3bobcat)
All times are GMT -4. The time now is 09:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy