If you are into optimization, and assuming the input is always one of the four characters, the function below might be worth a try as a replacement for the map:
char map(const char in) { return ((in & 2) ? '\x8a' - in : '\x95' - in); }
It works based on the fact that you are dealing with two symmetric pairs. The conditional works to tell apart the A/T pair from the G/C one (‘G’ and ‘C’ happen to have the second-least-significant bit in common). The remaining arithmetics performs the symmetric mapping. It’s based on the fact that a = (a + b) – b is true for any a,b.
Related Posts:
- What is C# equivalent of
- C++ Loop through Map
- How to find if a given key exists in a C++ std::map
- How can I print out C++ map values?
- Determine if map contains a value for a key?
- How exactly do lookup tables work and how to implement them?
- Google map that opens in a new window
- Is there a tool to get the GPS data from a WordPress blog on a map? [closed]
- Is “delete this” allowed in C++?
- What is a segmentation fault?
- How many spaces for tab character(\t)?
- How to create a dynamic array of integers
- How to create a dynamic array of integers
- Iterating over dictionaries using ‘for’ loops
- How to do associative array/hashing in JavaScript
- Linker Error C++ “undefined reference ” [duplicate]
- How do I sort a dictionary by value?
- How do I build a graphical user interface in C++? [closed]
- C++ convert from 1 char to string?
- How do I sort a dictionary by value?
- How do I build a graphical user interface in C++? [closed]
- convert a char* to std::string
- system(“pause”); – Why is it wrong?
- Pause Console in C++ program
- system(“pause”); – Why is it wrong?
- Pause Console in C++ program
- How to implement 2D vector array?
- Why the switch statement cannot be applied on strings?
- What is the difference between g++ and gcc?
- How to use setprecision in C++
- How to dynamically allocate arrays in C++
- How do I sort a dictionary by value?
- What does (~0L) mean?
- How to dynamically allocate arrays in C++
- What is the best way to use a HashMap in C++?
- What is the best way to use a HashMap in C++?
- What are the differences between a pointer variable and a reference variable in C++?
- Check if a given key already exists in a dictionary
- Why do we need virtual functions in C++?
- Why in C++ do we use DWORD rather than unsigned int? [duplicate]
- What is an undefined reference/unresolved external symbol error and how do I fix it?
- Sleep for milliseconds
- How to convert string to char array in C++?
- How can I convert a std::string to int?
- Easiest way to convert int to string in C++
- What is the difference between float and double?
- Why is “using namespace std;” considered bad practice?
- What is the easiest way to initialize a std::vector with hardcoded elements?
- What is the C++ function to raise a number to a power?
- outputting ascii table in C++
- How to overcome TypeError: unhashable type: ‘list’
- What is a lambda expression in C++11?
- How does collections.defaultdict work?
- Vector of Vectors to create matrix
- How to use the PI constant in C++
- How to throw a C++ exception
- std::string to char*
- How to generate a random number in C++?
- pinpointing “conditional jump or move depends on uninitialized value(s)” valgrind message
- What is an undefined reference/unresolved external symbol error and how do I fix it?
- How do I find the length of an array?
- Sleep for milliseconds
- How to convert string to char array in C++?
- C++ — expected primary-expression before ‘ ‘
- Using getline() with file input in C++
- What is the effect of extern “C” in C++?
- C++ Cout & Cin & System “Ambiguous” [closed]
- lvalue required as left operand of assignment error when using C++
- How do you create a dictionary in Java? [closed]
- ld: symbol(s) not found for architecture x86_64 error
- Python Dictionary Comprehension
- C++ string to double conversion
- Why are #ifndef and #define used in C++ header files?
- g++ ld: symbol(s) not found for architecture x86_64
- What exactly is the difference between “pass by reference” in C and in C++?
- How to use the PI constant in C++
- How to throw a C++ exception
- Conversion from string to char – c++
- How do I fix a “Expected Primary-expression before ‘)’ token” error?
- Is a Python dictionary an example of a hash table?
- How to find out if an item is present in a std::vector?
- What is meant by Resource Acquisition is Initialization (RAII)?
- When to use extern “C” in simple words? [duplicate]
- I’m getting Key error in python
- What is `CString`?
- Floating point exception( core dump
- Binary Search Tree Implementation in C++ STL?
- Initializing an array of objects
- Passing Arrays to Function in C++
- What does the explicit keyword mean?
- How do I print out the contents of a vector?
- Difference between != and =! with an example(in C++)
- Expression must have class type
- The static keyword and its various uses in C++
- Passing an array by reference
- Unresolved external symbol in object files
- When should you use a class vs a struct in C++?
- C++ error ‘Undefined reference to Class::Function()’ [duplicate]
- Return array in a function
- What is the ‘override’ keyword in C++ used for? [duplicate]